I'm trying to figure out how to build a xpath statement to get all the text
nodes besides from the 2nd <para> element of the 2nd <test> element. I
Is such a statement even possible in xpath?
Yes.
Also, how would I implement such a query on xslt?
Here's a quick and dirty stylesheet. There are, undoubtedly, more elegant means.
<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" indent="yes" />
<xsl:strip-space elements="*" />
<xsl:template match="/">
<xsl:apply-templates />
</xsl:template>
<xsl:template match="root">
<xsl:apply-templates />
</xsl:template>
<xsl:template match="test">
<xsl:apply-templates />
</xsl:template>
<xsl:template match="para[not(position()=2)]">
<xsl:value-of select="." />
</xsl:template>
<xsl:template
match="para[position()=2][parent::*[count(preceding-sibling::test)=1]]" />
</xsl:stylesheet>
--
Charles Knell
cknell(_at_)onebox(_dot_)com - email
Assuming I have a document like this:
<root>
<test>
<para>Text1</para>
<para>Text2</para>
<para>Text3</para>
</test>
<test>
<para>Text1</para>
<para>Text2</para>
<para>Text3</para>
</test>
<test>
<para>Text1</para>
<para>Text2</para>
<para>Text3</para>
</test>
</root>
--~------------------------------------------------------------------
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>
--~--