[Home] [By Thread] [By Date] [Recent Entries]
Hi Maria,
I want to copy some parts of the tree, under certains conditions, for example: The starting point for your stylesheet should be the identity template, which copies everything: <xsl:template match="node()|@*">
<xsl:copy>
<xsl:apply-templates select="@*|node()" />
</xsl:copy>
</xsl:template>You can then add empty templates for the various cases where you *don't* want particular elements to be copied... If <pred> in <tagB> contains the caracter 'z' then nothing should be copy from the <tagA> (and that <tagA> should not appear in the transformation). In other words, a <tagA> whose child <tagB>'s <pred> contains the letter 'z' should not be copied. <xsl:template match="tagA[contains(tagB/pred, 'z')]" /> Otherwise, I have to check if any <pred> tag inside <tagC> contains 'z', in that case, I cannot copy anyhing from the father tag (D or E). In other words, any child of <tagC> whose <pred> contains the letter 'z' should not be copied. <xsl:template match="tagC/*[contains(pred, 'z')]" /> Is important to mention that in case I have just one
I hope this gets you started. Cheers, Jeni -- Jeni Tennison http://www.jenitennison.com
|

Cart



