Hi,

I downloaded the June 25 nightly build, built it, and am running the xsltc.bat and 
xslt.bat scripts with jdk1.2.2.

There are two problems that I am getting at runtime, after I have compiled my 
stylesheets.

My test input is this:

<?xml version="1.0" encoding="UTF-8"?>
<message>
 <field type="TMPOS_F1" value="131523Z5"/>
 <field type="TMPOS_F4" value="12KTS"/>
</message>


If I use the following stylesheet I get the output I expect:

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; version="1.0">
 <xsl:output method="xml" indent="yes"/>
 <xsl:template match="text()"/>
 <xsl:template match="/">
  <xsl:apply-templates/>
 </xsl:template>
 <xsl:template match="message">
  <xsl:apply-templates/>
 </xsl:template>
 <xsl:template match="field[@type='TMPOS_F1']">
  <a_tdbm_platform_report_rec>
   <speed>
    <xsl:value-of select="following-sibling::field[@type='TMPOS_F4'][1]/@value"/>
   </speed>
  </a_tdbm_platform_report_rec>
 </xsl:template>
</xsl:stylesheet>

which is this:

<?xml version="1.0" encoding="utf-8" ?>
<a_tdbm_platform_report_rec>
  <speed>12KTS</speed>
</a_tdbm_platform_report_rec>

but if I try to use a variable to pass the value, as in this stylesheet:

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; version="1.0">
 <xsl:output method="xml" indent="yes"/>
 <xsl:template match="text()"/>
 <xsl:template match="/">
  <xsl:apply-templates/>
 </xsl:template>
 <xsl:template match="message">
   <xsl:apply-templates/>
 </xsl:template>
 <xsl:template match="field[@type='TMPOS_F1']">
  <a_tdbm_platform_report_rec>
   <xsl:variable name="value" 
select="following-sibling::field[@type='TMPOS_F4'][1]/@value"/>
   <speed>
    <xsl:value-of select="$value"/>
   </speed>
  </a_tdbm_platform_report_rec>
 </xsl:template>
</xsl:stylesheet>

then my output is just this:

<?xml version="1.0" encoding="utf-8" ?>
<a_tdbm_platform_report_rec>
  <speed/></a_tdbm_platform_report_rec>

In other words, the value got lost.

A different problem occurs when I try to use a longer xpath, as in this stylesheet:

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; version="1.0">
 <xsl:output method="xml" indent="yes"/>
 <xsl:template match="text()"/>
 <xsl:template match="/">
  <xsl:apply-templates/>
 </xsl:template>
 <xsl:template match="message/child::field[@type='TMPOS_F1']">
  <a_tdbm_platform_report_rec>
   <xsl:variable name="value" 
select="following-sibling::field[@type='TMPOS_F4'][1]/@value"/>
   <speed>
    <xsl:value-of select="$value"/>
   </speed>
  </a_tdbm_platform_report_rec>
 </xsl:template>
</xsl:stylesheet>

In this case there is no output at all (except for <?xml version="1.0" 
encoding="utf-8" ?>).

Thanks,

Jeff

Reply via email to