This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Differences between Saxon, XT and Xalan: testing an attribute value


Hi all,

I've simplified my problem to this XML document:

<?xml version="1.0" ?>
<Record id='1'>
  <Field No="606">
    <Subfield No="x">Use</Subfield>
  </Field>
</Record>

to which I apply the following stylesheet:

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
  <xsl:output method="xml" indent="yes"/>
  <xsl:template match="Record">
    <TestRecord>
      <xsl:apply-templates/>
    </TestRecord>
  </xsl:template>
  <xsl:template match="Field[@No='606']/Subfield[@No='x']">
    <GotAMatch><xsl:apply-templates/></GotAMatch>
  </xsl:template>
</xsl:stylesheet>

With both XT (version 19990511) and Xalan (version 0.19.5, not tested with the latest release), I get what I expected, which is:

<?xml version="1.0" encoding="utf-8"?>
<TestRecord>
  <GotAMatch>Use</GotAMatch>
</TestRecord>

But with Saxon (version 5.2), I get the following:

<TestRecord>
  Use
</TestRecord>

It looks like the template matching "Field[@No='606']/Subfield[@No='x']" is never fired.

If I change this template to this:

<xsl:template match="Field[@No='606']">
  <GotAMatch><xsl:apply-templates/></GotAMatch>
</xsl:template>

or this

<xsl:template match="Subfield[@No='x']">
  <GotAMatch><xsl:apply-templates/></GotAMatch>
</xsl:template>

Now the three processors give me the expected result, identical to the first one.

It looks a lot like a bug in Saxon, but may be I'm missing an obscure part in the XSL specs?

Thank's for any info,

Martin Sevigny
sevigny@ajlsm.com


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]