Subject: Re: Fwd: [xsl] curly braces From: Ihe Onwuka <ihe.onwuka@xxxxxxxxxxxxxx> Date: Thu, 20 Sep 2012 00:57:08 +0100 |
On Thu, Sep 20, 2012 at 12:11 AM, Michael Kay <mike@xxxxxxxxxxxx> wrote: > Ihe, > > Your stylesheet contains the element > > > <this:fieldName elem="productThumbnail" plural="thumbnails" > bracketType="{{"/> > > as part of the definition of a global variable. If this is executed as a > literal result element the result will be the element > > > <this:fieldName elem="productThumbnail" plural="thumbnails" > bracketType="{"/> > > (with a single "{"). > > But you are not executing it as a literal result element, you are reading it > from the source XML of the stylesheet using the function call doc(''). In > elements read from source documents, curly braces have no special > significance, so "{{" represents itself. If the element were in a normal > source document, then bracketType="{" would work fine, but because the > element has a dual role (as an element in a source document and as a literal > result element in a stylesheet), bracketType="{" is an error. > > The idea of reading the source document using document('') is a hack used in > XSLT 1.0 to get around the restrictions on using result tree fragments. It > is never needed in XSLT 2.0: use the global variable directly. (It's also a > very inefficient hack, because the stylesheet has to be parsed twice.) > I resorted to that hack because if I have this <xsl:variable name="this" as="node()"> <this:desiredFields> <product/><m__id/>...........<productThumbnail/> </this:desiredFields> </xsl:variable> and then try to use the variable $this as the third parameter in a call to the key function I get net.sf.saxon.trans.XPathException: In the key() function, the node supplied in the third argument (or the context node if absent) must be in a tree whose root is a document node
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: Fwd: [xsl] curly braces, Michael Kay | Thread | Re: Fwd: [xsl] curly braces, Imsieke, Gerrit, le- |
Re: Fwd: [xsl] curly braces, Michael Kay | Date | [xsl] program to merge xsl and xml , David Ryan |
Month |