This queue is for tickets about the XML-LibXSLT CPAN distribution.

Report information
The Basics
Id:
44119
Status:
rejected
Priority:
Low/Low
Queue:

People
Owner:
Nobody in particular
Requestors:
Robin.Murray [...] MorganStanley.com
Cc:
AdminCc:

BugTracker
Severity:
(no value)
Broken in:
(no value)
Fixed in:
(no value)



Subject: problem using <xsl:namespace-alias>
Date: Fri, 13 Mar 2009 23:32:15 -0400
To: <bug-XML-LibXSLT@rt.cpan.org>
From: "Murray, Robin \(IT\)" <Robin.Murray@MorganStanley.com>
* Dist: XML:LibXSLT 1.66-2.6.31 and 1.58
* Perl: This is perl, v5.8.8 built for i686-linux-thread-multi
* O/S: Linux 2.4.21-32.0.1.EL.msdwhugemem
 
Using test stylesheet:
 
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform
"
                xmlns:xslo="http://www.w3.org/1999/XSL/TransformAlias"
                version="1.0">
<xsl:namespace-alias stylesheet-prefix="xslo" result-prefix="xsl"/>
<xsl:template match="/">
  <xslo:stylesheet version="1.0">
    <xslo:template match="/">
      Hello! This text was created by an automatically generated stylesheet.
    </xslo:template>
  </xslo:stylesheet>
</xsl:template>
</xsl:stylesheet>
 
 
Running perl script:
my $xslt = XML::LibXSLT->new();
my $styleSheet = $xslt->parse_stylesheet_file($opt{xsl});
my $xml = $styleSheet->transform_file($opt{xml});
print $styleSheet->output_string($xml);
 
Output is:
<?xml version="1.0"?>
<xslo:stylesheet xmlns:xslo="http://www.w3.org/1999/XSL/Transform
" version="1.0">
<xslo:template match="/">
    Hello! This text was created by an automatically generated stylesheet.
</xslo:template>
</xslo:stylesheet>
According to the spec, the output should have had its namespace replaced with the 'result-prefix': 'xsl', but in this case it's still 'xslo'. I've tried various things to make this work but haven't been successful so far.
 
Thanks.
 
 
Robin Murray
Consultant | Technology
2000 Barrington St | Suite 300 | Floor 04 Halifax, B3J3K1
Phone: +1 902 442-4962
Mobile: +1 902 221-1317
robin.murray@morganstanley.com
 

NOTICE: If received in error, please destroy and notify sender. Sender does not intend to waive confidentiality or privilege. Use of this email is prohibited when received in error.

Dne pá 13.bře.2009 23:32:47, Robin.Murray@MorganStanley.com napsal(a):
Show quoted text
> * Dist: XML:LibXSLT 1.66-2.6.31 and 1.58 > * Perl: This is perl, v5.8.8 built for i686-linux-thread-multi > * O/S: Linux 2.4.21-32.0.1.EL.msdwhugemem > > Using test stylesheet: > > <?xml version="1.0" encoding="utf-8"?> > <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" > xmlns:xslo="http://www.w3.org/1999/XSL/TransformAlias" > version="1.0"> > <xsl:namespace-alias stylesheet-prefix="xslo" result-prefix="xsl"/> > <xsl:template match="/"> > <xslo:stylesheet version="1.0"> > <xslo:template match="/"> > Hello! This text was created by an automatically generated > stylesheet. > </xslo:template> > </xslo:stylesheet> > </xsl:template> > </xsl:stylesheet> > > > Running perl script: > my $xslt = XML::LibXSLT->new(); > my $styleSheet = $xslt->parse_stylesheet_file($opt{xsl}); > my $xml = $styleSheet->transform_file($opt{xml}); > print $styleSheet->output_string($xml); > > > Output is: > <?xml version="1.0"?> > <xslo:stylesheet xmlns:xslo="http://www.w3.org/1999/XSL/Transform" > version="1.0"> > <xslo:template match="/"> > Hello! This text was created by an automatically generated > stylesheet. > </xslo:template> > </xslo:stylesheet> > > According to the spec, the output should have had its namespace > replaced > with the 'result-prefix': 'xsl', but in this case it's still 'xslo'. > I've tried various things to make this work but haven't been > successful > so far. > > Thanks.
This is not a bug, read the spec again (http://www.w3.org/TR/xslt#literal-result-element). The spec only talks about changing the namespace URI in the result document, not the namespace prefix (prefixes are only means of associating elements with namespace URIs). By specifying <xsl:namespace-alias stylesheet-prefix="xslo" result-prefix="xsl"/> you simply say that the namespace URI http://www.w3.org/1999/XSL/TransformAlias should be mapped to http://www.w3.org/1999/XSL/Transform in the output document. In your example, the xslo prefix is mapped to the correct XSLT namespace in the result: xmlns:xslo="http://www.w3.org/1999/XSL/Transform" which is all the spec requires. The result document is a valid XSLT stylesheet. -- Petr


This service runs on Request Tracker, is sponsored by The Perl Foundation, and maintained by Best Practical Solutions.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.