You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xalan.apache.org by Sean Gilligan <se...@msgilligan.com> on 2006/08/11 23:44:54 UTC

Problem with XPath namespace axis?

I'm having a problem with Xalan Java 2.7.0.  The XPath expression:
document('')/xsl:stylesheet/namespace::exsl
does not seem to be doing the right thing.

Processing this file:
<?xml version="1.0" encoding="UTF-8"?>
<root2/>

With this stylesheet:
<?xml version='1.0'?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                xmlns:exsl="http://exslt.org/common"
                version='1.0'>
               
<xsl:template match="/">
  <xsl:element name="root">
    <xsl:copy-of select="document('')/xsl:stylesheet/namespace::exsl"/>
  </xsl:element>
 </xsl:template>
</xsl:stylesheet>

Produces:
<?xml version="1.0" encoding="UTF-8"?><root/>

The correct output (produced by xsltproc) should be:
<?xml version="1.0"?>
<root xmlns:exsl="http://exslt.org/common"/>


Info on my  Configuration is below:


#---- BEGIN writeEnvironmentReport($Revision: 1.29 $): Useful stuff 
found: ----
version.DOM.draftlevel=2.0fd
java.class.path=/opt/local/share/java/maven/lib/forehead-1.0-beta-5.jar:/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Classes/.compatibility/14compatibility.jar
version.JAXP=1.1 or higher
java.ext.dirs=/Library/Java/Extensions:/System/Library/Java/Extensions:/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home/lib/ext
version.xerces2=Xerces-J 2.7.1
version.xerces1=not-present
version.xalan2_2=Xalan Java 2.7.0
version.xalan1=not-present
version.ant=not-present
java.version=1.5.0_06
version.DOM=2.0
version.crimson=present-unknown-version
sun.boot.class.path=/System/Library/Frameworks/JavaVM.framework/Versions/1.5/Home/lib/endorsed/xalan-2.7.0.jar:/System/Library/Frameworks/JavaVM.framework/Versions/1.5/Home/lib/endorsed/xercesImpl-2.7.1.jar:/System/Library/Frameworks/JavaVM.framework/Versions/1.5/Home/lib/endorsed/xmlParserAPIs-2.6.2.jar:/opt/local/share/java/maven/lib/endorsed/xerces-2.4.0.jar:/opt/local/share/java/maven/lib/endorsed/xml-apis-1.0.b2.jar:/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Classes/classes.jar:/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Classes/ui.jar:/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Classes/laf.jar:/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Classes/sunrsasign.jar:/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Classes/jsse.jar:/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Classes/jce.jar:/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Classes/charsets.jar
version.SAX=2.0
version.xalan2x=Xalan Java 2.7.0
#----- END writeEnvironmentReport: Useful properties found: -----

Am I doing something wrong?  Is this a bug?  Is there a workaround?

I was going to create a JIRA report, but the Xalan site said to post to 
the users list first.

Thanks,

Sean


Re: Problem with XPath namespace axis?

Posted by Henry Zongaro <zo...@ca.ibm.com>.
Hello.

Sean Gilligan <se...@msgilligan.com> wrote on 2006-08-11 05:44:54 PM:
> I'm having a problem with Xalan Java 2.7.0.  The XPath expression:
> document('')/xsl:stylesheet/namespace::exsl
> does not seem to be doing the right thing.

Thanks for reporting the problem.  It appears to be a problem with 
xsl:copy-of.

See bug report XALANJ-2305 [1] for more information and a suggested 
work-around.  Another work-around would be to use XSLTC, which does not 
appear to have this problem.

I hope that helps.

Thanks,

Henry
[1] http://issues.apache.org/jira/browse/XALANJ-2305
------------------------------------------------------------------
Henry Zongaro      XSLT Processors Development
IBM SWS Toronto Lab   T/L 969-6044;  Phone +1 905 413-6044
mailto:zongaro@ca.ibm.com


Re: Problem with XPath namespace axis?

Posted by Sean Gilligan <se...@msgilligan.com>.
david_marston@us.ibm.com wrote:
> Sean Gilligan writes about a [known] problem with
> <xsl:copy-of select="document('')/xsl:stylesheet/namespace::exsl"/>
>
> One possible workaround that may be pretty universal is to try
> <xsl:copy-of 
> select="document('')/xsl:stylesheet/namespace::*[name(.)='exsl']"/>
> or maybe even try local-name(.) if desperate. Use string(.) to match the 
> namespace URI.
> .................David Marston
>
>
>   
Thanks for the responses.  The problem was occurring when using the 
DocBook XSL stylesheets to generate a custom titlepage.  I switched to 
Saxon to avoid the problem, but will submit the information to the 
docbook-apps mailing list as well.  In case anyone is interested, I'll 
provide the details of the DocBook XSL code.

I'm using DocBook XSL 1.69.1, although the problem appears to exist in 
the latest version (1.70.1) as well.
This excerpt starts at line 76 of the file template/titlepage.xsl:

<xsl:template match="t:templates">
  <xsl:element name="xsl:stylesheet">
     <xsl:copy-of select="document('')/xsl:stylesheet/namespace::exsl"/>
     ... snip ...
</xsl:template>

Regards,

Sean




Re: Problem with XPath namespace axis?

Posted by da...@us.ibm.com.
Sean Gilligan writes about a [known] problem with
<xsl:copy-of select="document('')/xsl:stylesheet/namespace::exsl"/>

One possible workaround that may be pretty universal is to try
<xsl:copy-of 
select="document('')/xsl:stylesheet/namespace::*[name(.)='exsl']"/>
or maybe even try local-name(.) if desperate. Use string(.) to match the 
namespace URI.
.................David Marston