xsl-list
[Top] [All Lists]

Re: Fwd: [xsl] curly braces

2012-09-19 19:27:50
You may wish to try the code I sent you on saxonhe-9.2.1.1.

I predict (don't know for sure because you are running a cut down
version of the code) the following

; SystemID: ; Line#: 10; Column#: -1
net.sf.saxon.trans.XPathException: Failed to load document
        at net.sf.saxon.expr.Expression.dynamicError(Expression.java:961)

where Line 10 is

<xsl:variable name="this" as="node()" select="doc('')"/>

Also try by substituting the above with the document function instead
of doc, you may see different behaviour.

On Thu, Sep 20, 2012 at 12:11 AM, Michael Kay <mike(_at_)saxonica(_dot_)com> 
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.)

Michael Kay
Saxonica



On 19/09/2012 12:03, Michael Kay wrote:

Could you please construct a complete example that demonstrates the
problem? We haven't been able to reproduce it.

(Ideally, product-specific issues shouldn't really go on this list.
But now the thread is started here, perhaps it's best to keep it here.)

Michael Kay
Saxonica

On 19/09/2012 11:47, Ihe Onwuka wrote:

The version that comes with Kernow. Saxon HE 9.3.0.5

On Wed, Sep 19, 2012 at 11:42 AM, O'Neil Delpratt
<oneil(_at_)saxonica(_dot_)com> wrote:

Hi,

According to the specification a single curly bracket is not allowed
in an attribute. Please see:

http://www.w3.org/TR/xslt20/#attribute-value-templates

In Saxon 9.4.0.5 the bracket {{ is replaced by the single bracket {,
which is correct.
Which version of Saxon are you using?




-------- Original Message --------
Subject: [xsl] curly braces
Date: Wed, 19 Sep 2012 04:19:53 +0100
From: Ihe Onwuka <ihe(_dot_)onwuka(_at_)googlemail(_dot_)com>
Reply-To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
To: xsl-list <xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com>


Not sure whether this is a saxon or XSLT issue (or just me for that
matter).

Saxon wouldn't allow me to  set the bracketType attrtibute to "{"
(Unexpected token "<eof>" in path expression)

     <xsl:variable name="fieldNames" as="element()*">
        <this:fieldName elem="product" plural="products"
bracketType="["/>
        <this:fieldName elem="productThumbnail" plural="thumbnails"
bracketType="{{"/>
     </xsl:variable

so I set it to "{{" as above, which Saxon accepts but inserts {{ into
my result tree instead of {.

I have a workaround (substring the bracketType attribute) but would
like an explanation please.

--~------------------------------------------------------------------
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(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--






kind regards,

--
O'Neil Delpratt
Software Developer, Saxonica Limited
Email: oneil(_at_)saxonica(_dot_)com
Tel: +44 118 946 5894
Web: http://www.saxonica.com
Saxonica Community Site: http://dev.saxonica.com

--~------------------------------------------------------------------
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(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--




--~------------------------------------------------------------------
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(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--




--~------------------------------------------------------------------
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(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>