You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-users@xalan.apache.org by al...@hsl.gov.uk on 2004/01/15 12:46:44 UTC
nodeset(), attributes and namespaces
Hi all,
I'm new to Xalan and still learning XSLT. I'm having a problem with the
xalan:nodeset() function. This contrived stylesheet is an example:
<?xml version="1.0"?>
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
xmlns:xalan="http://xml.apache.org/xalan"
xmlns:fd="http://www.example.com/fd"
exclude-result-prefixes="xalan"
>
<xsl:variable name="rtf">
<fd:docelem>
<fd:elem1>
<fd:elem1a fd:anatt="xyz">ELEMENT1A</fd:elem1a>
<fd:elem1b>,ELEMENT1B</fd:elem1b>
</fd:elem1>
<fd:elem2>
<fd:elem2a>ELEMENT2A</fd:elem2a>
</fd:elem2>
</fd:docelem>
</xsl:variable>
<xsl:template match="/">
<out>
<xsl:message terminate="yes">
<xsl:value-of
select="xalan:nodeset($rtf)/fd:docelem/fd:elem1/fd:elem1a/@fd:anatt" />
</xsl:message>
<xsl:for-each select="xalan:nodeset($rtf)/fd:docelem//*">
<xsl:value-of select="name(.)"/><xsl:text>,</xsl:text>
</xsl:for-each>
</out>
</xsl:template>
</xsl:stylesheet>
The source tree for this transform is irrelevant. When I execute the
transform:
xalan -o willbeempty.xml dummy.xml theabovestylesheet.xsl
the value of fd:anatt is not printed.
If I remove the namespace prefix from the anatt attribute in the result
tree fragment and in the call to value-of, the value of anatt is printed.
This effect is seen with attributes, but not elements.
Can anyone tell me why this is happening? Is it inappropriate to use
qualified names for attributes in RTFs.
Thanks,
Regards,
Alex Hogg
Computational Toxicology Section
Health Sciences Group
Health and Safety Laboratory
DD: (0114) 289 2606
Fax: (0114) 289 2850
alex.hogg@hsl.gov.uk
Re: nodeset(), attributes and namespaces
Posted by da...@us.ibm.com.
Hi Alex,
This is a legitimate bug in constructing RTFs, which I thought we had fixed
long ago. Can you please create a Bugzilla report and attach your
stylesheet so we can track this?
Thanks!
Dave
alex.hogg@hsl.go
v.uk To: xalan-c-users@xml.apache.org
cc: (bcc: David N Bertoni/Cambridge/IBM)
01/15/2004 03:46 Subject: nodeset(), attributes and namespaces
AM
Please respond
to xalan-c-users
Hi all,
I'm new to Xalan and still learning XSLT. I'm having a problem with the
xalan:nodeset() function. This contrived stylesheet is an example:
<?xml version="1.0"?>
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
xmlns:xalan="http://xml.apache.org/xalan"
xmlns:fd="http://www.example.com/fd"
exclude-result-prefixes="xalan"
>
<xsl:variable name="rtf">
<fd:docelem>
<fd:elem1>
<fd:elem1a fd:anatt="xyz">ELEMENT1A</fd:elem1a>
<fd:elem1b>,ELEMENT1B</fd:elem1b>
</fd:elem1>
<fd:elem2>
<fd:elem2a>ELEMENT2A</fd:elem2a>
</fd:elem2>
</fd:docelem>
</xsl:variable>
<xsl:template match="/">
<out>
<xsl:message terminate="yes">
<xsl:value-of
select="xalan:nodeset($rtf)/fd:docelem/fd:elem1/fd:elem1a/@fd:anatt" />
</xsl:message>
<xsl:for-each select="xalan:nodeset($rtf)/fd:docelem//*">
<xsl:value-of select="name(.)"/><xsl:text>,</xsl:text>
</xsl:for-each>
</out>
</xsl:template>
</xsl:stylesheet>
The source tree for this transform is irrelevant. When I execute the
transform:
xalan -o willbeempty.xml dummy.xml theabovestylesheet.xsl
the value of fd:anatt is not printed.
If I remove the namespace prefix from the anatt attribute in the result
tree fragment and in the call to value-of, the value of anatt is printed.
This effect is seen with attributes, but not elements.
Can anyone tell me why this is happening? Is it inappropriate to use
qualified names for attributes in RTFs.
Thanks,
Regards,
Alex Hogg
Computational Toxicology Section
Health Sciences Group
Health and Safety Laboratory
DD: (0114) 289 2606
Fax: (0114) 289 2850
alex.hogg@hsl.gov.uk