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 Mike Brown <mi...@skew.org> on 2006/08/29 18:43:42 UTC

strange xsl:system-property() behavior

Xalan-J 2.7.0's xsl:system-property() gives me strange results:

$ cat dummy.xml
<?xml version="1.0" encoding="utf-8"?><dummy/>


$ cat sysprops.xsl 
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

  <xsl:output method="xml" indent="yes"/>

  <xsl:template match="/">
    <system-properties>
      <version><xsl:value-of select="system-property('xsl:version')"/></version>
      <vendor><xsl:value-of select="system-property('xsl:vendor')"/></vendor>
      <vendor-url><xsl:value-of select="system-property('xsl:vendor-url')"/></vendor-url>
      <xsl:if test="system-property('f:version')" xmlns:f="http://xmlns.4suite.org/ext">
        <f:version><xsl:value-of select="system-property('f:version')"/></f:version>
      </xsl:if>
    </system-properties>
  </xsl:template>

</xsl:stylesheet>


$ xalan -IN dummy.xml -XSL sysprops.xsl -OUT out
file:///portnoy/home/mike/xml/test/sysprops.xsl; Line #12; Column #89; Do not currently do anything with namespace http://xmlns.4suite.org/ext in property: f:version
file:///portnoy/home/mike/xml/test/sysprops.xsl; Line #13; Column #73; Do not currently do anything with namespace http://xmlns.4suite.org/ext in property: f:version

$ cat out
<?xml version="1.0" encoding="UTF-8"?>
<system-properties>
<version>1</version>
<vendor>Apache Software Foundation</vendor>
<vendor-url>http://xml.apache.org/xalan-j</vendor-url>
<f:version xmlns:f="http://xmlns.4suite.org/ext">1</f:version>
</system-properties>


1. Why the namespace warnings? First, "Do not currently do anything with namespace" doesn't make sense (is this a request being made of me?) ... Second, I don't see why it's showing up; there's nothing wrong with my use of the namespace there.

2. Why is there a "1" as the value of the foreign system property? It shouldn't exist at all.

3. Furthermore, if I invoke org.apache.xalan.xslt.Process from the command line and give it a -v or -V argument, I'm told I'm running version 2.4.1, whereas I'm clearly running 2.7.0:

$ cd /home/mike/xml
$ /bin/ls -l xalan
lrwxr-xr-x  1 mike  mike  13 Aug 29 10:29 xalan -> xalan-j_2_7_0

$ java -classpath /home/mike/xml/xalan/bin/xalan.jar:/home/mike/xml/xalan/bin/xml-apis.jar:/home/mike/xml/xalan/bin/xercesImpl.jar org.apache.xalan.xslt.Process -V
>>>>>>> Xalan Version Xalan Java 2.4.1, <<<<<<<
Error: No stylesheet or input xml is specified. Run this command without any option for usage instructions.


These are bugs, right?


Re: strange xsl:system-property() behavior

Posted by Mike Brown <mi...@skew.org>.
Christine Li wrote:
> I think that you are using JDK 1.4+. The Xalan-J 2.7.0 on your classpath 
> is not used when you did the transformation. For more detail, please refer 
> to http://xml.apache.org/xalan-j/faq.html#faq-N100D6

That's helpful, thanks. Rather than setting a -classpath on the command line,
defining java.endorsed.dirs worked. I also had typos in my old classpath, I
noticed.

Things are looking better now that I'm definitely using Xalan-J 2.7.0 rather
than the version 2.4.1 that came with JDK 1.4.2.

However, I do still get a warning that seems spurious to me:

$ java -Djava.endorsed.dirs=/home/mike/xml/xalan org.apache.xalan.xslt.Process -IN dummy.xml -XSL sysprops.xsl -OUT out.xml
file:///portnoy/home/mike/xml/test/sysprops.xsl; Line #12; Column #89; Do not currently do anything with namespace http://xmlns.4suite.org/ext in property: f:version

out.xml looks better, at least.

Re: strange xsl:system-property() behavior

Posted by Christine Li <jy...@ca.ibm.com>.
I think that you are using JDK 1.4+. The Xalan-J 2.7.0 on your classpath 
is not used when you did the transformation. For more detail, please refer 
to http://xml.apache.org/xalan-j/faq.html#faq-N100D6

Hope it helps,

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



Mike Brown <mi...@skew.org> 
29/08/2006 12:43 PM

To
xalan-j-users@xml.apache.org
cc

Subject
strange xsl:system-property() behavior






Xalan-J 2.7.0's xsl:system-property() gives me strange results:

$ cat dummy.xml
<?xml version="1.0" encoding="utf-8"?><dummy/>


$ cat sysprops.xsl 
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0"
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

  <xsl:output method="xml" indent="yes"/>

  <xsl:template match="/">
    <system-properties>
      <version><xsl:value-of 
select="system-property('xsl:version')"/></version>
      <vendor><xsl:value-of 
select="system-property('xsl:vendor')"/></vendor>
      <vendor-url><xsl:value-of 
select="system-property('xsl:vendor-url')"/></vendor-url>
      <xsl:if test="system-property('f:version')" xmlns:f="
http://xmlns.4suite.org/ext">
        <f:version><xsl:value-of 
select="system-property('f:version')"/></f:version>
      </xsl:if>
    </system-properties>
  </xsl:template>

</xsl:stylesheet>


$ xalan -IN dummy.xml -XSL sysprops.xsl -OUT out
file:///portnoy/home/mike/xml/test/sysprops.xsl; Line #12; Column #89; Do 
not currently do anything with namespace http://xmlns.4suite.org/ext in 
property: f:version
file:///portnoy/home/mike/xml/test/sysprops.xsl; Line #13; Column #73; Do 
not currently do anything with namespace http://xmlns.4suite.org/ext in 
property: f:version

$ cat out
<?xml version="1.0" encoding="UTF-8"?>
<system-properties>
<version>1</version>
<vendor>Apache Software Foundation</vendor>
<vendor-url>http://xml.apache.org/xalan-j</vendor-url>
<f:version xmlns:f="http://xmlns.4suite.org/ext">1</f:version>
</system-properties>


1. Why the namespace warnings? First, "Do not currently do anything with 
namespace" doesn't make sense (is this a request being made of me?) ... 
Second, I don't see why it's showing up; there's nothing wrong with my use 
of the namespace there.

2. Why is there a "1" as the value of the foreign system property? It 
shouldn't exist at all.

3. Furthermore, if I invoke org.apache.xalan.xslt.Process from the command 
line and give it a -v or -V argument, I'm told I'm running version 2.4.1, 
whereas I'm clearly running 2.7.0:

$ cd /home/mike/xml
$ /bin/ls -l xalan
lrwxr-xr-x  1 mike  mike  13 Aug 29 10:29 xalan -> xalan-j_2_7_0

$ java -classpath 
/home/mike/xml/xalan/bin/xalan.jar:/home/mike/xml/xalan/bin/xml-apis.jar:/home/mike/xml/xalan/bin/xercesImpl.jar 
org.apache.xalan.xslt.Process -V
>>>>>>> Xalan Version Xalan Java 2.4.1, <<<<<<<
Error: No stylesheet or input xml is specified. Run this command without 
any option for usage instructions.


These are bugs, right?