[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Select value by position
> Thanks for any tips how to improve performance.. > <xsl:variable name="identifier"> > <xsl:value-of select="normalize-space(dc:identifier)"/> > </xsl:variable> Never use an xsl:variable with content like this unless you really need to generate a new result tree fragment 9which is essentially a new node tree with a root node (/) a text node with string value. that's expensive to build and has to be coersed back to a string when used. You just want a string here so <xsl:variable name="identifier"> select="normalize-space(dc:identifier)"/> which is less code to type and a lot more efficient (athough in this case you don't really need a variable at all). In xslt1 that will use the first dc:identifier, in xslt2 it will generate an error that there is more than one. Tou sie the second you can use <xsl:variable name="identifier"> select="normalize-space(dc:identifier[2])"/> or [last()] or whatever predicate you need to specify. <rdf:Description> <xsl:attribute name="rdf:about"><xsl:value-of select="$identifier"/></xsl:attribute> could be written more simply as <rdf:Description rdf:about="{$identifier}"> or just inline the variable if it is only used once: <rdf:Description rdf:about="{normalize-space(dc:identifier[2]}"> David
|
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
|