You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by Antonio Menchero =?iso-8859-1?Q?Fern�ndez?= <am...@aqs.es> on 2000/09/25 18:19:19 UTC

Problem with namespace prefixes with xalan1.2-D02

Hi,
I've found the next problem when upgrading to xalan1.2-D02:

I have two transformations chained:
The first takes a document from a file (actually an xml schema) with 
namespace prefixed elements, for example:
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/1999/XMLSchema">
         <xsd:element name="Sector">
                 <xsd:complexType content="empty">
                         <xsd:attribute name="id" use="required" 
i18n="false" type="xsd:long"/>
                         <xsd:attribute name="name" use="required" i18n="true">
                                 <xsd:simpleType name="string128" 
base="xsd:string">
                                         <xsd:maxLength value="128"/>
                                 </xsd:simpleType>
                         </xsd:attribute>
                 </xsd:complexType>
         </xsd:element>
and performs a transformation to produce a slightly different document in 
memory (DOM Document) (I have a StylesheeRoot object and use its 
process(XSLTInputSource, XSLTResultTarget) method to transform) :

the stylesheet is something like (style1):
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
version="1.0" xmlns:xsd="http://www.w3.org/1999/XMLSchema">
<xsl:template match="/">
         <xsl:apply-templates select="xsd:schema"/>
</xsl:template>

<xsl:template match="xsd:schema">
         <xsd:schema>
                 <xsl:attribute name="project">myproject</xsl:attribute>
...

and serializing the output document we can see prefixed elements:
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema defaultPropertiesPath="./lib" project="myproject" 
xmlns:xsd="http://www.w3.org/1999/XMLSchema">
         <xsd:element className="Sector" >
         ...

But when a second transformation is done with the previous Document as the 
input source, it seems like if namespace prefixes were not taken into 
account, in fact the next stylesheet does not work (style2):
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
version="1.0" xmlns:xsd="http://www.w3.org/1999/XMLSchema">
<xsl:template match="/">
         <xsl:apply-templates select="xsd:schema"/>
</xsl:template>

<xsl:template match="xsd:schema">
<output>
but this works (style2bad):
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
version="1.0" xmlns:xsd="http://www.w3.org/1999/XMLSchema">
<xsl:template match="/">
         <xsl:apply-templates select="schema"/>
</xsl:template>

<xsl:template match="schema">
<output>
If I make transformation with stylesheet 'style2' when the source is an xml 
file with the serialized document of the first transformation, it also works

Everything worked fine with Xalan1.1, any suggestions?.

Thanks in advance,

Antonio Menchero