I want to store a lump of XHTML within an XML element. The code is based on the case study in 'Professional XSL' published by WROX. (Excellant book by the way for those already into programming).
To avoid declaring XHTML tags in the schema the html is stuffed in one element <htmlcode>.
The XSLCOPY is used as in the code below.
This works fine as an application but I cannot validate the XML against the schema (it objects to <P> the first XHTML tag it finds. Does anyone know the data type / content that would tell the schema to ignore what is in this element?
<xsl:template match="webpage" >
<xsl:apply-templates select="htmlcode/node()" mode="html-output"/>
</xsl:template>
<!-- The node() in the apply templates above presumably passes everything to here Even if an XHTML tag looked like one of our XML tags it would be ignored -->
<xsl:template match="node()|@*" mode="html-output">
<!-- Here we copy everything with XHTML tags passed unchanged -->
<xsl:copy>
<xsl:apply-templates select="node()|@*" mode="html-output" />
</xsl:copy>
</xsl:template>
To avoid declaring XHTML tags in the schema the html is stuffed in one element <htmlcode>.
The XSLCOPY is used as in the code below.
This works fine as an application but I cannot validate the XML against the schema (it objects to <P> the first XHTML tag it finds. Does anyone know the data type / content that would tell the schema to ignore what is in this element?
<xsl:template match="webpage" >
<xsl:apply-templates select="htmlcode/node()" mode="html-output"/>
</xsl:template>
<!-- The node() in the apply templates above presumably passes everything to here Even if an XHTML tag looked like one of our XML tags it would be ignored -->
<xsl:template match="node()|@*" mode="html-output">
<!-- Here we copy everything with XHTML tags passed unchanged -->
<xsl:copy>
<xsl:apply-templates select="node()|@*" mode="html-output" />
</xsl:copy>
</xsl:template>