xsl-list
[Top] [All Lists]

RE: With Saxon7.2, can an aliased namespace prefix beexcludedfrom the output?

2002-11-15 06:24:23
I have been using Saxon7.2 with Cocoon2.0.4dev without
trouble until this problem.  I worked on it more last night and
found out that when running saxon from the command the
right output is generated, but running it from within cocoon
the output is not well formed.  With this new info, I am not
sure if the bug is in saxon or not.  See below for sample
code and output from each situation.

Tim

michael(_dot_)h(_dot_)kay(_at_)ntlworld(_dot_)com 11/14/02 06:01PM >>>
Using only one level of meta stylesheet, I agree that it is 
inelegant but usable.  The trouble happens when using two 
levels of meta stylesheets.  I start getting elements 
produced with a different namespace prefix on the ending tag 
(the alias prefix) than on the starting tag (the original 
prefix), among other problems.

Now that is a bug: please send in the evidence!

Michael Kay
Software AG
home: Michael(_dot_)H(_dot_)Kay(_at_)ntlworld(_dot_)com 
work: Michael(_dot_)Kay(_at_)softwareag(_dot_)com 

========================
Copy of email sent to cocoon-users list:

Subject: Output not well formed from Cocoon, but fine from Saxon on command line

Using Saxon7.2 in Cocoon 2.0.4dev from Nov 13 2002,
I apply stylesheet A to stylesheet B.
This produces stylesheet C, which is NOT well formed.
(Notice the <xsl:copy>...</x2:copy>)

Using Saxon7.2 from the command line,
I apply stylesheet A to stylesheet B.
This produces stylesheet D, which IS well formed.

Anybody have clues how to get this to work from Cocoon?

Tim

---

Stylesheet A:

<?xml version="1.0"?>
<xsl:stylesheet version="2.0"
  xmlns:xsl = "http://www.w3.org/1999/XSL/Transform";
  xmlns:x2  = "http://www.w3.org/1999/XSL/TransformAlias";
  exclude-result-prefixes="x2">

  <xsl:namespace-alias stylesheet-prefix="x2" result-prefix="xsl"/>
  <xsl:template match="/">
    <xsl:copy>
      <xsl:apply-templates select="@*|node()"/>
    </xsl:copy>
  </xsl:template>

  <xsl:template match="x2:stylesheet">
    <xsl:copy>
      <xsl:apply-templates select="@*|node()"/>
      <x2:template match="sometag"><a-tag/></x2:template>
    </xsl:copy>
  </xsl:template>

  <xsl:template match="@*|node()">
    <xsl:copy>
      <xsl:apply-templates select="@*|node()"/>
    </xsl:copy>
  </xsl:template>

</xsl:stylesheet>

Stylesheet B:

<?xml version="1.0"?>
<xsl:stylesheet version="2.0"
  xmlns:xsl  = "http://www.w3.org/1999/XSL/Transform";
  xmlns:x    = "http://www.w3.org/1999/XSL/TransformAlias";
  exclude-result-prefixes="x">
  <xsl:namespace-alias stylesheet-prefix="x" result-prefix="xsl"/>
  <xsl:template match="/">
    <xsl:copy>
      <x:stylesheet>
        <x:template match="/"><x:value-of select="test"/></x:template>
      </x:stylesheet>
    </xsl:copy>
  </xsl:template>
</xsl:stylesheet>

Stylesheet C:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0" exclude-result-prefixes="x" 
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; 
xmlns:x="http://www.w3.org/1999/XSL/TransformAlias";>
  <xsl:namespace-alias stylesheet-prefix="x" result-prefix="xsl"/>
  <xsl:template match="/">
    <xsl:copy>
      <x:stylesheet>
        <x:template match="/"><x:value-of select="test"/></x:template>
      <x2:template match="sometag" 
xmlns:x2="http://www.w3.org/1999/XSL/Transform";><a-tag/></x2:template></x:stylesheet>
    </x2:copy>
  </x2:template>
</x2:stylesheet>

Stylesheet D:

<?xml version="1.0" encoding="utf-8"?><xsl:stylesheet 
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; 
xmlns:x="http://www.w3.org/1999/XSL/TransformAlias"; version="2.0" 
exclude-result-prefixes="x">
  <xsl:namespace-alias stylesheet-prefix="x" result-prefix="xsl"/>
  <xsl:template match="/">
    <xsl:copy>
      <x:stylesheet>
        <x:template match="/"><x:value-of select="test"/></x:template>
      <x2:template xmlns:x2="http://www.w3.org/1999/XSL/Transform"; 
match="sometag"><a-tag/></x2:template></x:stylesheet>
    </xsl:copy>
  </xsl:template>
</xsl:stylesheet>




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



<Prev in Thread] Current Thread [Next in Thread>
  • RE: With Saxon7.2, can an aliased namespace prefix beexcludedfrom the output?, Timothy Larson <=