[Home] [By Thread] [By Date] [Recent Entries]
At 11:33 AM 1/11/2005, 'twas written:
> The source is coming from MS Word documents. I only want to be > able to use > data such as bullets, lists, and tables. All other elements I > would like to > ignore like graphs, images, etc. Watch out ... on this example: <Q>
<X>
... stuff ...
</X>
<Y>
... stuff ...
</Y>
<Z>
... stuff ...
</Z>
</Q>the above stylesheet would result in an empty document (nothing would be copied). You could debug it by switching <!-- ignore everything --> <xsl:template match="*" /> to <!-- by default, pass everything without copying
(though since this template is built in it doesn't
have to be included literally) -->
<xsl:template match="*">
<xsl:apply-templates/>
</xsl:template><!-- by default, suppress text nodes
(wanted text nodes are picked up in 'copy' mode -->
<xsl:template match="text()"/>and also tweak <xsl:template match="X|Y|Z">
<xsl:copy>
<xsl:apply-templates mode="copy" select="*|*@" />
<xsl:copy>
</xsl:template>to say <xsl:apply-templates mode="copy" select="node()|@*"/> -- since by selecting "*|@*" you'll skip the text nodes. (Or just say plain xsl:apply-templates mode="copy" and add an <xsl:copy-of select="@*"/> ahead of it to grab the attributes. Cheers, Wendell
|

Cart



