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
<tagD> inside <tagC>, and that <tagD> contains 'z',
nothing including <tagA> should be copied.
<xsl:template match="tagA[count(tagC/tagD) = 1 and
contains(tagC/tagD/pred, 'z')]" />
I hope this gets you started.
Cheers,
Jeni
--
Jeni Tennison
http://www.jenitennison.com
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--