[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: characters in xsl
<xsl:variable name="x" select="'Fred'"/> vs <xsl:variable name="x" >Fred</xsl:variable> Is that the difference? The latter creating a document tree, the former not? No. The former makes a string so that doesn't come in to the picture at all, <xsl:apply-templates select="$x"/> would generate an error (as in XSL 1) that apply templates can only be applied to nodes. The latter makes (for 1.0 compatibility reasons) a node set with a document node and a text node, you could apply templates to that, but again not really relevant as we're talking of element nodes mainly. <xsl:variable name="x" > <stone/> </xsl:variable> makes (for compatibilty with XSLT 1) a document (root) node with child an element node with name stone. <xsl:apply-templates select="$x"/> would work and templates matching "stone" or "//stone" would apply. However you can also do this <xsl:variable name="x" as="element()"> <stone/> </xsl:variable> which makes $x into _just_ a free standing element node with no parent. Now <xsl:apply-templates select="$x"/> would work and templates matching "stone" would apply but thiose matching "//stone" would not. David ________________________________________________________________________ This e-mail has been scanned for all viruses by Star. The service is powered by MessageLabs. For more information on a proactive anti-virus service working around the clock, around the globe, visit: http://www.star.net.uk ________________________________________________________________________
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|