RE: [xsl] xsl:apply-templates to all but...

Subject: RE: [xsl] xsl:apply-templates to all but...
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Fri, 17 Feb 2006 14:25:02 -0000
> The issue: if element w has content model (x,y,z) and I want 
> to output its
> contents in (y,z,x) order, I could do this:
> 
>   <xsl:template match="w">
>     <xsl:apply-templates select"y"/>
>     <xsl:apply-templates select"z"/>
>     <xsl:apply-templates select"x"/>
>   </xsl:template>

Or, in 2.0,

      <xsl:apply-templates select"y, z, x"/>
> 
> But if something later gets added to that content model, this template
> rule will ignore it. 

So you could do

      <xsl:apply-templates select"y, z, * except (y, z)"/>

Michael Kay
http://www.saxonica.com/

Current Thread