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 Christine Li <jy...@ca.ibm.com> on 2003/04/24 16:05:49 UTC

Re: Problem with XPath expression using JDK1.4.1 with Xalan 2.2 and higher

I tried with JDK 1.4.0_03 and Xalan 2.5, it works fine. I was using command
line:
java
-Djavax.xml.parsers.DocumentBuilderFactory=org.apache.xerces.jaxp.DocumentBuilderFactoryImpl

org.apache.xalan.xslt.Process -xsl tst.xsl -in tst.xml

the xsl is :
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version=
"1.0">
<xsl:template match="/">
  <out>
      <xsl:value-of select="/page/@session"/>
  </out>
</xsl:template>
</xsl:stylesheet>

Christine Li
XSLT Development
IBM Toronto Lab
Tel: (905)413-2601
Email: jycli@ca.ibm.com


                                                                                                                                        
                      "Anders Samuelson"                                                                                                
                      <anders.samuelson@        To:       <xa...@xml.apache.org>                                                
                      aspiro.com>               cc:                                                                                     
                                                Subject:  Problem with XPath expression using JDK1.4.1 with Xalan 2.2 and higher        
                      04/24/2003 09:46                                                                                                  
                      AM                                                                                                                
                                                                                                                                        
                                                                                                                                        





Hi,

Given the follwing  extract of a xml page -

<?xml  version="1.0" encoding="UTF-8"?>
<page user-id="User1" service="Login"  session="41845463" base-url
="servlets/WUDisp"  cache-time="0">
<page-area id="pa1" title="Login">
<paragraph  id="p1">
<action id="a1" text="Ok" type="internal" service="MNU"  function="Main"
button="accept"/>
</paragraph>
</page-area>
</page>

- I'm trying to  access the 'base-url' and 'session' attributes of the page
element with the  XPath expression {/page/@base-url} and {/page/@session}.
(For the complete  java code and stylesheet see attachments. Execute the
java class with the  command:
java
-Djavax.xml.parsers.DocumentBuilderFactory=org.apache.xerces.jaxp.DocumentBuilderFactoryImpl

 TransformTest)

This works fine  using JDK 1.4.1 and putting Xalan 2.1 and Xercex 1.4.3 in
the endorsed  directory. However using any later versions e.g. Xalan 2.5
together with  Xerces 2.4 fails. The expressions evaluate to "" instead of
the values given in  the xml source.

I'm not using any  default namespace so there should be no issues there?!

Any help solving  this problem is greatly appreciated!

Cheers,

Anders



------------------------------
Aspiro AB
Anders Samuelson,  M Sc
Box 118
S-201 21 Malmö
Sweden

Mobile: +46 709 918017
Fax: +46 40 579771

http://www.aspiro.com
---------------------------





#### dial11_wml.xsl has been removed from this note on April 24 2003 by
Christine Li
#### TransformTest.java has been removed from this note on April 24 2003 by
Christine Li
#### TransformTest.class has been removed from this note on April 24 2003
by Christine Li