[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: Select on Node List Variable

Subject: RE: Select on Node List Variable
From: "Michael Kay" <mhk@xxxxxxxxx>
Date: Sat, 5 Jun 2004 07:22:32 +0100
xsl select
The variable item-elements is the root node of a temporary tree, and when
you apply-templates to it, the template rule invoked is the one with
match="/". Use apply-templates select="$var/*", or use a mode.

Note that Saxon 6.5 does not correctly enforce all the restrictions in the
XSLT 1.0 specification, which prevent you using a result tree fragment as a
node-set in this way.

Michael Kay 

> -----Original Message-----
> From: Roger L. Cauvin [mailto:roger@xxxxxxxxxx] 
> Sent: 05 June 2004 03:11
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject:  Select on Node List Variable
> 
> I am having trouble understanding the behavior of the 
> following stylesheet.
> I intended for the main template to build a node-list of 
> <item> elements and
> then process them using another template, but instead Saxon 
> 6.5.2 is giving
> me a stack overflow error.  If I change the 'apply-templates' and
> corresponding template to use a mode, it works as intended 
> (outputs 'hello'
> and 'goodbye').
> 
> <?xml version="1.0" ?>
> 
> <xsl:stylesheet version="1.0"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
>   <xsl:output method="xml" indent="yes" omit-xml-declaration="yes"
> standalone="no"/>
> 
>   <xsl:template match="/">
>     <xsl:variable name="item-elements">
>       <xsl:element name="item">hello</xsl:element>
>       <xsl:element name="item">goodbye</xsl:element>
>     </xsl:variable>
>     <xsl:apply-templates select="$item-elements"/>
>   </xsl:template>
> 
>   <xsl:template match="item">
>     <xsl:value-of select="."/>
>     <xsl:if test="position() != last()">
>       <xsl:text>&#10;</xsl:text>
>     </xsl:if>
>   </xsl:template>
> 
> </xsl:stylesheet>
> 
> Why the infinite loop?
> 
> --
> Roger L. Cauvin
> roger@xxxxxxxxxx
> 
> 
> --+------------------------------------------------------------------
> 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@xxxxxxxxxxxxxxxxxxxxxx>
> --+--
> 
> 



Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.