XPath default namespace does not work if source is XML Schema or an XSLT stylesheet

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

XPath default namespace does not work if source is XML Schema or an XSLT stylesheet

George Cristian Bina
Hi,

We encountered a strange behaviour of Saxon 8.5.1 when setting the
xpath-default-namespace either to the XML Schema namespace,
http://www.w3.org/2001/XMLSchema or to the XSLT namespace,
http://www.w3.org/1999/XSL/Transform.

If the root element is schema and stylesheet, respectively then the
matches on the schema and stylesheet do not work anymore.

Sample XSLT (test.xsl):

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0"
     xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
     xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
     <xsl:output method="text"/>
     <xsl:template match="schema">
         Got a schema.
     </xsl:template>
     <xsl:template match="*"></xsl:template>
</xsl:stylesheet>

Sample source file (test.xsd)

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
     <xs:element name="test"/>
</xs:schema>

the stylesheet can be applied on any XML Schema file and will not show
the expected "Got a schema" message.

E:\workspace\oXygen>java -cp lib/saxon8.jar net.sf.saxon.Transform
test.xsd test.xsl

E:\workspace\oXygen>

Changing the http://www.w3.org/2001/XMLSchema namespace to
http://www.w3.org/2001/XMLSchema2 for instance in both the stylesheet
and the text.xsd above gives:

E:\workspace\oXygen>java -cp lib/saxon8.jar net.sf.saxon.Transform
test.xsd test.xsl

         Got a schema.

E:\workspace\oXygen>

Thanks for looking into this.

Best Regards,
George
---------------------------------------------------------------------
George Cristian Bina
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com


-------------------------------------------------------
This SF.Net email is sponsored by the JBoss Inc.
Get Certified Today * Register for a JBoss Training Course
Free Certification Exam for All Training Attendees Through End of 2005
Visit http://www.jboss.com/services/certification for more information
_______________________________________________
saxon-help mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/saxon-help
Reply | Threaded
Open this post in threaded view
|

Re: XPath default namespace does not work if source is XML Schema or an XSLT stylesheet

George Cristian Bina
One thing that I forgot to mention: if the source document is passed in
a DOMSource then it works fine, we got the problem only when using a
SAXSource.

Best Regards,
George
---------------------------------------------------------------------
George Cristian Bina
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com


George Cristian Bina wrote:

> Hi,
>
> We encountered a strange behaviour of Saxon 8.5.1 when setting the
> xpath-default-namespace either to the XML Schema namespace,
> http://www.w3.org/2001/XMLSchema or to the XSLT namespace,
> http://www.w3.org/1999/XSL/Transform.
>
> If the root element is schema and stylesheet, respectively then the
> matches on the schema and stylesheet do not work anymore.
>
> Sample XSLT (test.xsl):
>
> <?xml version="1.0" encoding="UTF-8"?>
> <xsl:stylesheet version="2.0"
>     xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>     xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
>     <xsl:output method="text"/>
>     <xsl:template match="schema">
>         Got a schema.
>     </xsl:template>
>     <xsl:template match="*"></xsl:template>
> </xsl:stylesheet>
>
> Sample source file (test.xsd)
>
> <?xml version="1.0" encoding="UTF-8"?>
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
>     <xs:element name="test"/>
> </xs:schema>
>
> the stylesheet can be applied on any XML Schema file and will not show
> the expected "Got a schema" message.
>
> E:\workspace\oXygen>java -cp lib/saxon8.jar net.sf.saxon.Transform
> test.xsd test.xsl
>
> E:\workspace\oXygen>
>
> Changing the http://www.w3.org/2001/XMLSchema namespace to
> http://www.w3.org/2001/XMLSchema2 for instance in both the stylesheet
> and the text.xsd above gives:
>
> E:\workspace\oXygen>java -cp lib/saxon8.jar net.sf.saxon.Transform
> test.xsd test.xsl
>
>         Got a schema.
>
> E:\workspace\oXygen>
>
> Thanks for looking into this.
>
> Best Regards,
> George
> ---------------------------------------------------------------------
> George Cristian Bina
> <oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
> http://www.oxygenxml.com
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by the JBoss Inc.
> Get Certified Today * Register for a JBoss Training Course
> Free Certification Exam for All Training Attendees Through End of 2005
> Visit http://www.jboss.com/services/certification for more information
> _______________________________________________
> saxon-help mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/saxon-help


-------------------------------------------------------
This SF.Net email is sponsored by the JBoss Inc.
Get Certified Today * Register for a JBoss Training Course
Free Certification Exam for All Training Attendees Through End of 2005
Visit http://www.jboss.com/services/certification for more information
_______________________________________________
saxon-help mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/saxon-help
Reply | Threaded
Open this post in threaded view
|

RE: XPath default namespace does not work if source is XML Schema or an XSLT stylesheet

Michael Kay
In reply to this post by George Cristian Bina
I'll look into this. It's entirely believable that this is a bug: Saxon
often treats well-known namespaces specially.

Michael Kay

> -----Original Message-----
> From: [hidden email]
> [mailto:[hidden email]] On Behalf Of
> George Cristian Bina
> Sent: 26 October 2005 10:36
> To: [hidden email]
> Subject: [saxon] XPath default namespace does not work if
> source is XML Schema or an XSLT stylesheet
>
> Hi,
>
> We encountered a strange behaviour of Saxon 8.5.1 when setting the
> xpath-default-namespace either to the XML Schema namespace,
> http://www.w3.org/2001/XMLSchema or to the XSLT namespace,
> http://www.w3.org/1999/XSL/Transform.
>
> If the root element is schema and stylesheet, respectively then the
> matches on the schema and stylesheet do not work anymore.
>
> Sample XSLT (test.xsl):
>
> <?xml version="1.0" encoding="UTF-8"?>
> <xsl:stylesheet version="2.0"
>      xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>      xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
>      <xsl:output method="text"/>
>      <xsl:template match="schema">
>          Got a schema.
>      </xsl:template>
>      <xsl:template match="*"></xsl:template>
> </xsl:stylesheet>
>
> Sample source file (test.xsd)
>
> <?xml version="1.0" encoding="UTF-8"?>
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
>      <xs:element name="test"/>
> </xs:schema>
>
> the stylesheet can be applied on any XML Schema file and will
> not show
> the expected "Got a schema" message.
>
> E:\workspace\oXygen>java -cp lib/saxon8.jar net.sf.saxon.Transform
> test.xsd test.xsl
>
> E:\workspace\oXygen>
>
> Changing the http://www.w3.org/2001/XMLSchema namespace to
> http://www.w3.org/2001/XMLSchema2 for instance in both the stylesheet
> and the text.xsd above gives:
>
> E:\workspace\oXygen>java -cp lib/saxon8.jar net.sf.saxon.Transform
> test.xsd test.xsl
>
>          Got a schema.
>
> E:\workspace\oXygen>
>
> Thanks for looking into this.
>
> Best Regards,
> George
> ---------------------------------------------------------------------
> George Cristian Bina
> <oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
> http://www.oxygenxml.com
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by the JBoss Inc.
> Get Certified Today * Register for a JBoss Training Course
> Free Certification Exam for All Training Attendees Through End of 2005
> Visit http://www.jboss.com/services/certification for more information
> _______________________________________________
> saxon-help mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/saxon-help
>





-------------------------------------------------------
This SF.Net email is sponsored by the JBoss Inc.
Get Certified Today * Register for a JBoss Training Course
Free Certification Exam for All Training Attendees Through End of 2005
Visit http://www.jboss.com/services/certification for more information
_______________________________________________
saxon-help mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/saxon-help
Reply | Threaded
Open this post in threaded view
|

RE: XPath default namespace does not work if source is XML Schema or an XSLT stylesheet

Michael Kay
In reply to this post by George Cristian Bina
Thanks, now fixed.

Michael Kay

> -----Original Message-----
> From: [hidden email]
> [mailto:[hidden email]] On Behalf Of
> George Cristian Bina
> Sent: 26 October 2005 10:36
> To: [hidden email]
> Subject: [saxon] XPath default namespace does not work if
> source is XML Schema or an XSLT stylesheet
>
> Hi,
>
> We encountered a strange behaviour of Saxon 8.5.1 when setting the
> xpath-default-namespace either to the XML Schema namespace,
> http://www.w3.org/2001/XMLSchema or to the XSLT namespace,
> http://www.w3.org/1999/XSL/Transform.
>
> If the root element is schema and stylesheet, respectively then the
> matches on the schema and stylesheet do not work anymore.
>
> Sample XSLT (test.xsl):
>
> <?xml version="1.0" encoding="UTF-8"?>
> <xsl:stylesheet version="2.0"
>      xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>      xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
>      <xsl:output method="text"/>
>      <xsl:template match="schema">
>          Got a schema.
>      </xsl:template>
>      <xsl:template match="*"></xsl:template>
> </xsl:stylesheet>
>
> Sample source file (test.xsd)
>
> <?xml version="1.0" encoding="UTF-8"?>
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
>      <xs:element name="test"/>
> </xs:schema>
>
> the stylesheet can be applied on any XML Schema file and will
> not show
> the expected "Got a schema" message.
>
> E:\workspace\oXygen>java -cp lib/saxon8.jar net.sf.saxon.Transform
> test.xsd test.xsl
>
> E:\workspace\oXygen>
>
> Changing the http://www.w3.org/2001/XMLSchema namespace to
> http://www.w3.org/2001/XMLSchema2 for instance in both the stylesheet
> and the text.xsd above gives:
>
> E:\workspace\oXygen>java -cp lib/saxon8.jar net.sf.saxon.Transform
> test.xsd test.xsl
>
>          Got a schema.
>
> E:\workspace\oXygen>
>
> Thanks for looking into this.
>
> Best Regards,
> George
> ---------------------------------------------------------------------
> George Cristian Bina
> <oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
> http://www.oxygenxml.com
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by the JBoss Inc.
> Get Certified Today * Register for a JBoss Training Course
> Free Certification Exam for All Training Attendees Through End of 2005
> Visit http://www.jboss.com/services/certification for more information
> _______________________________________________
> saxon-help mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/saxon-help
>




-------------------------------------------------------
This SF.Net email is sponsored by the JBoss Inc.
Get Certified Today * Register for a JBoss Training Course
Free Certification Exam for All Training Attendees Through End of 2005
Visit http://www.jboss.com/services/certification for more information
_______________________________________________
saxon-help mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/saxon-help
Reply | Threaded
Open this post in threaded view
|

Re: XPath default namespace does not work if source is XML Schema or an XSLT stylesheet

George Cristian Bina
Thanks!

Best Regards,
George
---------------------------------------------------------------------
George Cristian Bina
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com


Michael Kay wrote:

> Thanks, now fixed.
>
> Michael Kay
>
>> -----Original Message-----
>> From: [hidden email]
>> [mailto:[hidden email]] On Behalf Of
>> George Cristian Bina
>> Sent: 26 October 2005 10:36
>> To: [hidden email]
>> Subject: [saxon] XPath default namespace does not work if
>> source is XML Schema or an XSLT stylesheet
>>
>> Hi,
>>
>> We encountered a strange behaviour of Saxon 8.5.1 when setting the
>> xpath-default-namespace either to the XML Schema namespace,
>> http://www.w3.org/2001/XMLSchema or to the XSLT namespace,
>> http://www.w3.org/1999/XSL/Transform.
>>
>> If the root element is schema and stylesheet, respectively then the
>> matches on the schema and stylesheet do not work anymore.
>>
>> Sample XSLT (test.xsl):
>>
>> <?xml version="1.0" encoding="UTF-8"?>
>> <xsl:stylesheet version="2.0"
>>      xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>>      xpath-default-namespace="http://www.w3.org/2001/XMLSchema">
>>      <xsl:output method="text"/>
>>      <xsl:template match="schema">
>>          Got a schema.
>>      </xsl:template>
>>      <xsl:template match="*"></xsl:template>
>> </xsl:stylesheet>
>>
>> Sample source file (test.xsd)
>>
>> <?xml version="1.0" encoding="UTF-8"?>
>> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
>>      <xs:element name="test"/>
>> </xs:schema>
>>
>> the stylesheet can be applied on any XML Schema file and will
>> not show
>> the expected "Got a schema" message.
>>
>> E:\workspace\oXygen>java -cp lib/saxon8.jar net.sf.saxon.Transform
>> test.xsd test.xsl
>>
>> E:\workspace\oXygen>
>>
>> Changing the http://www.w3.org/2001/XMLSchema namespace to
>> http://www.w3.org/2001/XMLSchema2 for instance in both the stylesheet
>> and the text.xsd above gives:
>>
>> E:\workspace\oXygen>java -cp lib/saxon8.jar net.sf.saxon.Transform
>> test.xsd test.xsl
>>
>>          Got a schema.
>>
>> E:\workspace\oXygen>
>>
>> Thanks for looking into this.
>>
>> Best Regards,
>> George
>> ---------------------------------------------------------------------
>> George Cristian Bina
>> <oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
>> http://www.oxygenxml.com
>>
>>
>> -------------------------------------------------------
>> This SF.Net email is sponsored by the JBoss Inc.
>> Get Certified Today * Register for a JBoss Training Course
>> Free Certification Exam for All Training Attendees Through End of 2005
>> Visit http://www.jboss.com/services/certification for more information
>> _______________________________________________
>> saxon-help mailing list
>> [hidden email]
>> https://lists.sourceforge.net/lists/listinfo/saxon-help
>>
>
>
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by the JBoss Inc.
> Get Certified Today * Register for a JBoss Training Course
> Free Certification Exam for All Training Attendees Through End of 2005
> Visit http://www.jboss.com/services/certification for more information
> _______________________________________________
> saxon-help mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/saxon-help


-------------------------------------------------------
This SF.Net email is sponsored by the JBoss Inc.
Get Certified Today * Register for a JBoss Training Course
Free Certification Exam for All Training Attendees Through End of 2005
Visit http://www.jboss.com/services/certification for more information
_______________________________________________
saxon-help mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/saxon-help