well, one way that is super slow is:
<xsl:copy-of select="following-sibling::elem2[not (contains
(preceding-sibling::elem-2, "break"))]"/>
<!-- select all elem2 nodes that are have no preceding sibling that has
the word break in it -->
a faster way might be:
<!-- create a variable with the index of the word break -->
<xsl:variable name="break-pos">
<xsl:for-each select="following-sibling::elem2[contains (., "break")]">
<xsl:value-of select="position()"/>
</xsl:for-each>
</xsl:variable>
<!-- copy all elem2's that occur before that index -->
<xsl:copy-of select="following-sibling::elem2[position() <
number($break-pos)"/>
this assumes that only one elem2 contains the word 'break'.
Niko Matsakis
DataPower technology
Chandra - wrote:
Hi all,
I had earlier emailed regarding a break point in the an xml
document. I need to transform the following document into another Xml
document such that any tag below "break" should not be displayed.
The XSLT transformation is such that I am having to do this from the
<xsl:template match= "elem1"> block. So my context or current node is
<elem1>. How do I do it from here. I am having difficulty in writing
the proper XPath exressions for this. Any help is greatly appreciated.
Thanks
Chandra
<root>
<elem1>
data1
</elem1>
<elem2>
<selem2>
data2
</selem2>
</elem2>
<!---Below this all should be removed except for root tag-->
<elem2>
<selem2>
<ssubelem2>
<sssubelem2 attr="break">break
</sssubelem2>
</ssubelem2>
</selem2>
</elem2>
<elem2>
<selem2>
data2
</selem2>
</elem2>
<elem2>
<selem2>
data2
</selem2>
</elem2>
</root>
_________________________________________________________________
The new MSN 8: smart spam protection and 2 months FREE*
http://join.msn.com/?page=features/junkmail
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list