I want to convert one xml format to another xml format by using xslt 2.0.Now i want to get the next immediate following::node() elements of the context node.for example,
This is my xml document:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<w:document xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main"
xmlns:v="urn:schemas-microsoft-com:vml">
<w:body>
<w:p>para1</w:p> <!-- assume this as context node -->
<w:tbl>table data 1</w:tbl>
<w:tbl>table data 2</w:tbl>
<w:p>para2</w:p>
<w:tbl>table data 3</w:tbl>
<w:tbl>table data 4</w:tbl>
<w:tbl>table data 5</w:tbl>
<w:tbl>table data 6</w:tbl>
<w:p>para3</w:p>
</w:body>
</w:document>
So,as per the context node mentioned in the above xml file, i want to select only table data 1 and table data2.
for example, if my context node is para2 then i want to select table data 3,table data 4,table data 5 and table data 6 only.
So, i have written xslt like this,
<xsl:for-each select="following::node()/self::w:tbl">
<xsl:choose>
<xsl:when test="self::w:tbl">
<xsl:apply-templates select="self::w:tbl"></xsl:apply-templates>
</xsl:when>
</xsl:choose>
</xsl:for-each>
But it produced wrong result…
Please Guide me to get out of this issue…
Here’s a function that might be useful:
Then you can call
f:adjacently-following(., xs:QName('w:tbl'))