Subject: [xsl] Was it a bug? From: Frederic Bergeron <fbergeron@xxxxxxxxxxxxx> Date: Wed, 17 Nov 2010 20:27:33 +0900 |
Hi, I have the following XML input file: <lom xmlns:xsi="http://www.w3.org/2001/XMLSchemainstance" xsi:schemaLocation="http://ltsc.ieee.org/xsd/LOM http://ltsc.ieee.org/xsd/lomv1.0/lom.xsd" xmlns="http://ltsc.ieee.org/xsd/LOM"> </lom> And the following XSLT transformation file: <xsl:stylesheet version="1.0" xmlns:lom="http://ltsc.ieee.org/xsd/LOM" xmlns="http://www.imsglobal.org/xsd/lodeilox_v1p0/digital_LO" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xml="http://www.w3.org/XML/1998/namespace" exclude-result-prefixes="lom"> <xsl:output method="xml" indent="yes"/> <xsl:template match="lom:lom" mode="work-description-main-metadata"> <xsl:element name="{local-name()}" namespace="http://www.mystuff.com"> <xsl:attribute name="myatt">myval</xsl:attribute> <xsl:apply-templates/> </xsl:element> </xsl:template> <xsl:template match="*" mode="work-description-main-metadata"> <xsl:element name="{local-name()}" namespace="http://www.mystuff.com"> <xsl:copy-of select="@*"/> <xsl:apply-templates select="*|text()"/> </xsl:element> </xsl:template> <xsl:template match="lom:lom"> <xsl:element name="work"> <xsl:attribute name="xsi:schemaLocation">http://www.imsglobal.org/xsd/lodeilox_v1p0/digital_LO http://www.imsglobal.org/xsd/imsloilox_v1p0_ilox_work_v1p0.xsd</xsl:attribute> <xsl:element name="identifier">myidentifier</xsl:element> <xsl:element name="description"> <xsl:element name="metadata"> <xsl:element name="schema">http://ltsc.ieee.org/xsd/LOM/imslode/ilox/work/main</xsl:element> <xsl:apply-templates select="self::*" mode="work-description-main-metadata"/> </xsl:element> </xsl:element> </xsl:element> </xsl:template> </xsl:stylesheet> When I use Xalan 2.6.0 (the default XSLT processor of the JRE 1.6.0_21-b07, if I'm not mistaken), I get the following output: <work xmlns="http://www.imsglobal.org/xsd/lodeilox_v1p0/digital_LO" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.imsglobal.org/xsd/lodeilox_v1p0/digital_LO http://www.imsglobal.org/xsd/imsloilox_v1p0_ilox_work_v1p0.xsd"> <identifier>myidentifier</identifier> <description> <metadata> <schema>http://ltsc.ieee.org/xsd/LOM/imslode/ilox/work/main</schema> <ns0:lom xmlns:ns0="http://www.mystuff.com" myatt="myval"> </ns0:lom> </metadata> </description> </work> When I use Saxon 8.7 or Xalan 2.7.0, I get the following output: <work xmlns="http://www.imsglobal.org/xsd/lodeilox_v1p0/digital_LO" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.imsglobal.org/xsd/lodeilox_v1p0/digital_LO http://www.imsglobal.org/xsd/imsloilox_v1p0_ilox_work_v1p0.xsd"> <identifier>myidentifier</identifier> <description> <metadata> <schema>http://ltsc.ieee.org/xsd/LOM/imslode/ilox/work/main</schema> <lom xmlns="http://www.mystuff.com" myatt="myval"> </lom> </metadata> </description> </work> Why, in the first case, do I have a generated prefix ns0 for the lom element and that I don't have one in the second case? Was it a bug in the oldest version of Xalan? Or is my XSLT ambiguous? Regards, Frederic Bergeron
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] How to recover/continue f, Jack Bush | Thread | Re: [xsl] Was it a bug?, David Carlisle |
Re: [xsl] How to recover/continue f, Michael Kay | Date | Re: [xsl] Was it a bug?, David Carlisle |
Month |