AVTs no longer work in xml:base

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

AVTs no longer work in xml:base

Eric van der Vlist
Hi,

There seems to be an issue with AVTs in xml:base attributes in Saxon
9.6.0.5 (tested with oXygen 17).

The repro is pretty simple:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:xs="http://www.w3.org/2001/XMLSchema"
    exclude-result-prefixes="xs"
    version="2.0">
   
    <xsl:template match="/">
        <xsl:variable
name="base-directory">http://example.com</xsl:variable>
        <test xml:base="{$base-directory}"/>
    </xsl:template>
   
</xsl:stylesheet>

gives the following error:

System ID: /tmp/xmlbase.xsl
Scenario: self
XSL file: /tmp/xmlbase.xsl
XML file: /tmp/xmlbase.xsl
Engine name: Saxon-EE 9.6.0.5
Severity: error
Description: Illegal character in path at index 0: {$base-directory}

Thanks,

Eric




------------------------------------------------------------------------------
Monitor Your Dynamic Infrastructure at Any Scale With Datadog!
Get real-time metrics from all of your servers, apps and tools
in one place.
SourceForge users - Click here to start your Free Trial of Datadog now!
http://pubads.g.doubleclick.net/gampad/clk?id=241902991&iu=/4140
_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
[hidden email]
https://lists.sourceforge.net/lists/listinfo/saxon-help 
Reply | Threaded
Open this post in threaded view
|

Re: AVTs no longer work in xml:base

Eric van der Vlist
Hmmm...

Thinking more about it, the new behavior makes sense if you consider
that xml:base attributes should be processed according to the xml:base
recommendation in their source XSLT transformation considered as an XML
document...

Eric

Le jeudi 10 septembre 2015 à 12:11 +0200, Eric van der Vlist a écrit :

> Hi,
>
> There seems to be an issue with AVTs in xml:base attributes in Saxon
> 9.6.0.5 (tested with oXygen 17).
>
> The repro is pretty simple:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>     xmlns:xs="http://www.w3.org/2001/XMLSchema"
>     exclude-result-prefixes="xs"
>     version="2.0">
>    
>     <xsl:template match="/">
>         <xsl:variable
> name="base-directory">http://example.com</xsl:variable>
>         <test xml:base="{$base-directory}"/>
>     </xsl:template>
>    
> </xsl:stylesheet>
>
> gives the following error:
>
> System ID: /tmp/xmlbase.xsl
> Scenario: self
> XSL file: /tmp/xmlbase.xsl
> XML file: /tmp/xmlbase.xsl
> Engine name: Saxon-EE 9.6.0.5
> Severity: error
> Description: Illegal character in path at index 0: {$base-directory}
>
> Thanks,
>
> Eric
>
>



------------------------------------------------------------------------------
Monitor Your Dynamic Infrastructure at Any Scale With Datadog!
Get real-time metrics from all of your servers, apps and tools
in one place.
SourceForge users - Click here to start your Free Trial of Datadog now!
http://pubads.g.doubleclick.net/gampad/clk?id=241902991&iu=/4140
_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
[hidden email]
https://lists.sourceforge.net/lists/listinfo/saxon-help 
Reply | Threaded
Open this post in threaded view
|

Re: AVTs no longer work in xml:base

Jirka Kosek
On 10.9.2015 12:24, Eric van der Vlist wrote:
> Thinking more about it, the new behavior makes sense if you consider
> that xml:base attributes should be processed according to the xml:base
> recommendation in their source XSLT transformation considered as an XML
> document...

You should still be able to use xsl:attribute to generate xml:base on
the fly.

                                Jirka

--
------------------------------------------------------------------
  Jirka Kosek      e-mail: [hidden email]      http://xmlguru.cz
------------------------------------------------------------------
     Professional XML and Web consulting and training services
DocBook/DITA customization, custom XSLT/XSL-FO document processing
------------------------------------------------------------------
 OASIS DocBook TC member, W3C Invited Expert, ISO JTC1/SC34 rep.
------------------------------------------------------------------
    Bringing you XML Prague conference    http://xmlprague.cz
------------------------------------------------------------------


------------------------------------------------------------------------------
Monitor Your Dynamic Infrastructure at Any Scale With Datadog!
Get real-time metrics from all of your servers, apps and tools
in one place.
SourceForge users - Click here to start your Free Trial of Datadog now!
http://pubads.g.doubleclick.net/gampad/clk?id=241902991&iu=/4140
_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
[hidden email]
https://lists.sourceforge.net/lists/listinfo/saxon-help 

signature.asc (203 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: AVTs no longer work in xml:base

Michael Kay
In reply to this post by Eric van der Vlist
The XSLT 2.0 spec explicitly warns about this in 11.1.2:

<quote>
The xml:base, xml:lang, xml:space, and xml:id attributes have two effects in XSLT. They behave as standard XSLT attributes, which means for example that if they appear on a literal result element, they will be copied to the result tree in the same way as any other attribute. In addition, they have their standard meaning as defined in the core XML specifications. Thus, an xml:base attribute in the stylesheet affects the base URI of the element on which it appears, and an xml:space attribute affects the interpretation of whitespace text nodes within that element. One consequence of this is that it is inadvisable to write these attributes as attribute value templates: although an XSLT processor will understand this notation, the XML parser will not. See also 11.1.4 Namespace Aliasing which describes how to use xsl:namespace-alias with these attributes.
</quote>

So you should either use xsl:attribute, or use namespace aliasing to generate these attributes.

Michael Kay
Saxonica



> On 10 Sep 2015, at 11:11, Eric van der Vlist <[hidden email]> wrote:
>
> Hi,
>
> There seems to be an issue with AVTs in xml:base attributes in Saxon
> 9.6.0.5 (tested with oXygen 17).
>
> The repro is pretty simple:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>    xmlns:xs="http://www.w3.org/2001/XMLSchema"
>    exclude-result-prefixes="xs"
>    version="2.0">
>
>    <xsl:template match="/">
>        <xsl:variable
> name="base-directory">http://example.com</xsl:variable>
>        <test xml:base="{$base-directory}"/>
>    </xsl:template>
>
> </xsl:stylesheet>
>
> gives the following error:
>
> System ID: /tmp/xmlbase.xsl
> Scenario: self
> XSL file: /tmp/xmlbase.xsl
> XML file: /tmp/xmlbase.xsl
> Engine name: Saxon-EE 9.6.0.5
> Severity: error
> Description: Illegal character in path at index 0: {$base-directory}
>
> Thanks,
>
> Eric
>
>
>
>
> ------------------------------------------------------------------------------
> Monitor Your Dynamic Infrastructure at Any Scale With Datadog!
> Get real-time metrics from all of your servers, apps and tools
> in one place.
> SourceForge users - Click here to start your Free Trial of Datadog now!
> http://pubads.g.doubleclick.net/gampad/clk?id=241902991&iu=/4140
> _______________________________________________
> saxon-help mailing list archived at http://saxon.markmail.org/
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/saxon-help 


------------------------------------------------------------------------------
Monitor Your Dynamic Infrastructure at Any Scale With Datadog!
Get real-time metrics from all of your servers, apps and tools
in one place.
SourceForge users - Click here to start your Free Trial of Datadog now!
http://pubads.g.doubleclick.net/gampad/clk?id=241902991&iu=/4140
_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
[hidden email]
https://lists.sourceforge.net/lists/listinfo/saxon-help 
Reply | Threaded
Open this post in threaded view
|

Re: AVTs no longer work in xml:base

Eric van der Vlist
In reply to this post by Eric van der Vlist
Just to mention that this behavior is normal!

Sorry for the noise,

Eric

Le jeudi 10 septembre 2015 à 12:11 +0200, Eric van der Vlist a écrit :

> Hi,
>
> There seems to be an issue with AVTs in xml:base attributes in Saxon
> 9.6.0.5 (tested with oXygen 17).
>
> The repro is pretty simple:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>     xmlns:xs="http://www.w3.org/2001/XMLSchema"
>     exclude-result-prefixes="xs"
>     version="2.0">
>    
>     <xsl:template match="/">
>         <xsl:variable
> name="base-directory">http://example.com</xsl:variable>
>         <test xml:base="{$base-directory}"/>
>     </xsl:template>
>    
> </xsl:stylesheet>
>
> gives the following error:
>
> System ID: /tmp/xmlbase.xsl
> Scenario: self
> XSL file: /tmp/xmlbase.xsl
> XML file: /tmp/xmlbase.xsl
> Engine name: Saxon-EE 9.6.0.5
> Severity: error
> Description: Illegal character in path at index 0: {$base-directory}
>
> Thanks,
>
> Eric
>
>



------------------------------------------------------------------------------
Monitor Your Dynamic Infrastructure at Any Scale With Datadog!
Get real-time metrics from all of your servers, apps and tools
in one place.
SourceForge users - Click here to start your Free Trial of Datadog now!
http://pubads.g.doubleclick.net/gampad/clk?id=241902991&iu=/4140
_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
[hidden email]
https://lists.sourceforge.net/lists/listinfo/saxon-help 
Reply | Threaded
Open this post in threaded view
|

Re: AVTs no longer work in xml:base

Eric van der Vlist
In reply to this post by Michael Kay
Yes, I should have read the doc ;) !

I have been mistaken by the fact that previous versions of Saxon behave
differently, sorry for the noise.

Thanks,

Eric

Le jeudi 10 septembre 2015 à 12:23 +0100, Michael Kay a écrit :

> The XSLT 2.0 spec explicitly warns about this in 11.1.2:
>
> <quote>
> The xml:base, xml:lang, xml:space, and xml:id attributes have two effects in XSLT. They behave as standard XSLT attributes, which means for example that if they appear on a literal result element, they will be copied to the result tree in the same way as any other attribute. In addition, they have their standard meaning as defined in the core XML specifications. Thus, an xml:base attribute in the stylesheet affects the base URI of the element on which it appears, and an xml:space attribute affects the interpretation of whitespace text nodes within that element. One consequence of this is that it is inadvisable to write these attributes as attribute value templates: although an XSLT processor will understand this notation, the XML parser will not. See also 11.1.4 Namespace Aliasing which describes how to use xsl:namespace-alias with these attributes.
> </quote>
>
> So you should either use xsl:attribute, or use namespace aliasing to generate these attributes.
>
> Michael Kay
> Saxonica
>
>
>
> > On 10 Sep 2015, at 11:11, Eric van der Vlist <[hidden email]> wrote:
> >
> > Hi,
> >
> > There seems to be an issue with AVTs in xml:base attributes in Saxon
> > 9.6.0.5 (tested with oXygen 17).
> >
> > The repro is pretty simple:
> >
> > <?xml version="1.0" encoding="UTF-8"?>
> > <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> >    xmlns:xs="http://www.w3.org/2001/XMLSchema"
> >    exclude-result-prefixes="xs"
> >    version="2.0">
> >
> >    <xsl:template match="/">
> >        <xsl:variable
> > name="base-directory">http://example.com</xsl:variable>
> >        <test xml:base="{$base-directory}"/>
> >    </xsl:template>
> >
> > </xsl:stylesheet>
> >
> > gives the following error:
> >
> > System ID: /tmp/xmlbase.xsl
> > Scenario: self
> > XSL file: /tmp/xmlbase.xsl
> > XML file: /tmp/xmlbase.xsl
> > Engine name: Saxon-EE 9.6.0.5
> > Severity: error
> > Description: Illegal character in path at index 0: {$base-directory}
> >
> > Thanks,
> >
> > Eric
> >
> >
> >
> >
> > ------------------------------------------------------------------------------
> > Monitor Your Dynamic Infrastructure at Any Scale With Datadog!
> > Get real-time metrics from all of your servers, apps and tools
> > in one place.
> > SourceForge users - Click here to start your Free Trial of Datadog now!
> > http://pubads.g.doubleclick.net/gampad/clk?id=241902991&iu=/4140
> > _______________________________________________
> > saxon-help mailing list archived at http://saxon.markmail.org/
> > [hidden email]
> > https://lists.sourceforge.net/lists/listinfo/saxon-help 
>
>
> ------------------------------------------------------------------------------
> Monitor Your Dynamic Infrastructure at Any Scale With Datadog!
> Get real-time metrics from all of your servers, apps and tools
> in one place.
> SourceForge users - Click here to start your Free Trial of Datadog now!
> http://pubads.g.doubleclick.net/gampad/clk?id=241902991&iu=/4140
> _______________________________________________
> saxon-help mailing list archived at http://saxon.markmail.org/
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/saxon-help 
>



------------------------------------------------------------------------------
_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
[hidden email]
https://lists.sourceforge.net/lists/listinfo/saxon-help 
Reply | Threaded
Open this post in threaded view
|

Re: AVTs no longer work in xml:base

Michael Kay

> On 11 Sep 2015, at 08:35, Eric van der Vlist <[hidden email]> wrote:
>
> Yes, I should have read the doc ;) !
>
> I have been mistaken by the fact that previous versions of Saxon behave
> differently, sorry for the noise.
>

I don’t think there’s a conscious change, but it might be sensitive to slight variations in the stylesheet. Saxon (at stylesheet compile time) is going to look at the xml:base attribute and attempt to resolve it if there is any descendant element in the stylesheet whose static base URI needs to be known, and that attempt is going to fail if it’s not a valid URI. It’s also possible that it’s changed to resolving it eagerly rather than lazily.

Michael Kay
Saxonica


------------------------------------------------------------------------------
_______________________________________________
saxon-help mailing list archived at http://saxon.markmail.org/
[hidden email]
https://lists.sourceforge.net/lists/listinfo/saxon-help