Apply-templates

Subject: Apply-templates
From: Thomas Karlsen <ThomasK@xxxxxxxxxxxxxxx>
Date: Thu, 16 Dec 1999 10:18:54 +0100
I have a question
Is it possible, when you apply-templates, to decide that it should apply
from position()=3 and out the siblings.

XML:
<section>
 <item>I am item number 1</item>
 <item>I am item number 2</item>
 <item>I am item number 3</item>
 <item>I am item number 4</item>
</section>

XSL:
<xsl:template match="section">
 <xsl:apply-templates select="following-sibling::item[position() = 3]
</xsl:template>

<xsl:template match="item">
 <xsl:value-of select="."/><br/>
</xsl:template>

So the output should be:
I am item number 3<br/>I am item number 4<br/>

I dont get this to work?

__ Thomas Karlsen | System Developer
__ Cell Network ASA | New Media Science | Sørkedalsveien 10A, N-0304 Oslo,
Norway
    Tel: +47 23196600 | Fax: +47 23196601 | Mob: +47 91514293


> -----Original Message-----
> From: Kay Michael [mailto:Michael.Kay@xxxxxxx]
> Sent: 15. desember 1999 14:58
> To: 'xsl-list@xxxxxxxxxxxxxxxx'
> Subject: RE: what are node set fragments and why are they ruining my
> life?
> 
> 
> >then I get the bizarre result [from Saxon] - 
> 
> >member local-name=member, id=1
> >member local-name=member, id=2
> >member local-name=RESULT-TREE-FRAGMENT, id=
> >member 1member 2
> 
> > - which looks like a new bug to me. 
> 
> Bizarre perhaps, but not a bug. sxf:node-set is documented to 
> work this way.
> As well as putting the dummy root node in as a parent for the 
> user-written
> nodes, it also wraps a dummy element around them, to make the 
> fragment a
> well-formed document. This was basically done for code reuse 
> reasons, and
> because at the time it was written the implementation of result tree
> fragments was not exposed to the application.
> 
> This will change in the next version to work the same as xt.
> 
> I'm hitting a few other problems in the area of output XML 
> not needing to be
> a well-formed document, e.g. when calling a DocumentHandler 
> to process the
> output, or when chaining it into another stylesheet. (The 
> contract with a
> SAX DocumentHandler of course says that the sequence of 
> events will always
> be well-formed). It's an area where the spec seems a bit 
> vague, e.g. it
> seems perfectly possible to output
> 
> <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
> <element1/>
> <element2/>
> 
> which is neither a well-formed document nor a well-formed 
> external entity.
> 
> 
> Mike Kay
> 
> 
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
> 


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread