Re: [xsl] axis specifier issue

Subject: Re: [xsl] axis specifier issue
From: Martin Honnen <Martin.Honnen@xxxxxx>
Date: Fri, 30 Oct 2009 18:20:08 +0100
a kusa wrote:
What I want is that any <note> element that is below <desc> and before<prt2>
to be pushed under <prt2>.

With XSLT 2.0 you can achieve that as follows:


<xsl:stylesheet
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
  version="2.0">

  <xsl:template match="@* | node()">
    <xsl:copy>
      <xsl:apply-templates select="@*, node()"/>
    </xsl:copy>
  </xsl:template>

<xsl:template match="prt1">
<xsl:copy>
<xsl:apply-templates select="@*, node() except note[. &gt;&gt; current()/desc[1] and . &lt;&lt; current()/prt2[1]]"/>
</xsl:copy>
</xsl:template>


<xsl:template match="prt2">
<xsl:copy>
<xsl:apply-templates select="@*, preceding-sibling::note[. &gt;&gt; current()/preceding-sibling::desc[1]], node()"/>
</xsl:copy>
</xsl:template>


</xsl:stylesheet>

--

	Martin Honnen
	http://msmvps.com/blogs/martin_honnen/

Current Thread