RE: [xsl] Namespace issue when running a Xalan transform through Java

Subject: RE: [xsl] Namespace issue when running a Xalan transform through Java
From: "Etheridge, Stephen" <stephen.etheridge@xxxxxxxxxx>
Date: Fri, 27 Aug 2010 08:46:22 +0100
Martin et al

The extra namespace declarations all appear in elements that are in a
different namespace in the source, but which need to end up in the
namespace www.logica.com/project and are transformed by the following
extract of a stylesheet:

<xsl:template match="*" mode="copy">
			<xsl:variable name="element-name"
select="local-name()"></xsl:variable>
			<xsl:choose>
				<xsl:when test="contains($element-name,
'List')">
					<xsl:call-template
name="process-lists"></xsl:call-template>
				</xsl:when>
				<xsl:otherwise>
					<xsl:element
name="{local-name()}" namespace="http://www.logica.com/project";>
					<xsl:apply-templates
mode="copy"></xsl:apply-templates>
					</xsl:element>
				</xsl:otherwise>
			</xsl:choose>

</xsl:template>


<xsl:template name="process-lists">
	<xsl:variable name="element-name"
select="local-name()"></xsl:variable>
	<xsl:element name="{$element-name}"
namespace="http://www.logica.com/pnd";><xsl:value-of
select="./dip:N"/></xsl:element>
	<xsl:variable name="local-element-val"><xsl:value-of
select="$element-name"/><xsl:text>LocalVal</xsl:text></xsl:variable>
	<xsl:element name="{$local-element-val}"
namespace="http://www.logica.com/project";><xsl:value-of
select="./dip:NP"/></xsl:element>
</xsl:template>

The namespace addition to the <xsl:element> processing is not reproduced
by XSLTProc or Xalan via the command line, only in the default javax
implementation.


Kind regards
Stephen

-----Original Message-----
From: Martin Honnen [mailto:Martin.Honnen@xxxxxx]
Sent: 26 August 2010 17:25
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: Re: [xsl] Namespace issue when running a Xalan transform
through Java

Etheridge, Stephen wrote:

> The XSL and XML are very large and on a separate network so I would
have
> some trouble supplying even minimal versions.
>
> However the XML is of the form:
>
> <RecordBatch>
> 	<BatchHeader/>
> 	<RecordMessage>
> 		<RecordHeader/>
> 		<Record/>
> 	</RecordMessage>
> </RecordBatch>
>
> The namespaces are all appearing in the child elements of <Record>

Sorry, but to tell you whether the issue is with the stylesheet or with
the XSLT processor you use we need to see XSLT code.
Or, as already suggested, run a different Java XSLT processor (Saxon
implements the JAXP interfaces) to compare the results.

--

	Martin Honnen
	http://msmvps.com/blogs/martin_honnen/



Please help Logica to respect the environment by not printing this email  /
Pour contribuer comme Logica au respect de l'environnement, merci de ne pas
imprimer ce mail /  Bitte drucken Sie diese Nachricht nicht aus und helfen Sie
so Logica dabei, die Umwelt zu sch|tzen. /  Por favor ajude a Logica a
respeitar o ambiente nao imprimindo este correio electronico.



This e-mail and any attachment is for authorised use by the intended
recipient(s) only. It may contain proprietary material, confidential
information and/or be subject to legal privilege. It should not be copied,
disclosed to, retained or used by, any other party. If you are not an intended
recipient then please promptly delete this e-mail and any attachment and all
copies and inform the sender. Thank you.

Current Thread