RE: [xsl] namespaces problem - two transformations in one stylesheet possible?

Subject: RE: [xsl] namespaces problem - two transformations in one stylesheet possible?
From: "Andrew Ballantine" <andrew.ballantine@xxxxxxxxxxxxxxx>
Date: Tue, 7 Feb 2006 15:02:45 -0000
Using the two original examples I gave, I get the following in XMLSpy v5 rel
4. The "real" system uses MSXML4.

XML:

<?xml version="1.0" encoding="UTF-8"?>
<message xmlns="http://www.valid_url.com";>
	<m_control>
		<various_control_tags />
	</m_control>
	<m_content>
		<b_control>
			<various_other_control_tags />
		</b_control>
		<message_contents />
	</m_content>
</message>

XSL:

<xsl:stylesheet version="1.0"
xmlns:userDefined="http://mycompany.com/mynamespace";
xmlns:msxsl="urn:schemas-microsoft-com:xslt"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
exclude-result-prefixes="msxsl" extension-element-prefixes="userDefined"
xmlns:msg="http://www.valid_url.com";>
	<xsl:output method="xml" indent="yes" omit-xml-declaration="no"/>
	<xsl:template match="/">
		<xsl:apply-templates select="message"/>
	</xsl:template>
	<xsl:template match="msg:message">
		<xsl:apply-templates select="m_content"/>
	</xsl:template>
	<xsl:template match="msg:m_content">
		<quotation dtd-version="1.0">
			<versn>2.0</versn>
			<xsl:apply-templates select="m_control"/>
			<!-- assorted other templates -->
		</quotation>
	</xsl:template>
	<!--  Quotes/control -->
	<xsl:template match="msg:m_control">
		<!-- etc lots more xsl here -->
	</xsl:template>
</xsl:stylesheet>

Result:

<?xml version="1.0" encoding="UTF-16"?>

If I remove the namespace stuff I get:

XML:

<?xml version="1.0" encoding="UTF-8"?>
<message>
	<m_control>
		<various_control_tags />
	</m_control>
	<m_content>
		<b_control>
			<various_other_control_tags />
		</b_control>
		<message_contents />
	</m_content>
</message>

XSL:

<?xml version="1.0" encoding="UTF-8"?>
<message>
	<m_control>
		<various_control_tags />
	</m_control>
	<m_content>
		<b_control>
			<various_other_control_tags />
		</b_control>
		<message_contents />
	</m_content>
</message>

Result:

<?xml version="1.0" encoding="UTF-16"?>
<quotation dtd-version="1.0">
<versn>2.0</versn>
</quotation>

Is it perhaps the <xsl:template match="/"> and if so is there something else I
can use for this?

best regards,

Andrew Ballantine

-----Original Message-----
From: Jon Gorman [mailto:jonathan.gorman@xxxxxxxxx]
Sent: 07 February 2006 14:48
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: Re: [xsl] namespaces problem - two transformations in one
stylesheet possible?


> Sorry andrew, but this has been tried and does not seem to
> work. Is there something I am missing here, or is my original
> question valid?

Well, without seeing what you did in your attempts to try to correct
your code in lines with Andrew's suggestion, it's rather difficult to
know if you're missing something.  His suggestions should have worked
for you.

What does the new styelsheet look like, what parser are you using,
what xslt processor, what system, what's the error message etc?  All
of these might be good questions to try to get to the root of the
problem.  (Well, posting the answer to the first and third might get
you the farthest on this list)

I'm pretty sure removing the namespace is either in the faq or can be
found by a search of the archives.

It would be more straightforward to follow Andrew's suggestion though.
 (Random guess, you didn't change all the paths to include the prefix
msg)


Jon Gorman


This e-mail is private and confidential and is protected by copyright. It may
also be privileged or otherwise protected by other legal rules.  Access by or
disclosure to anyone other than the intended recipient for any reason other
than the business purpose for which the message is intended, is unauthorised.
If you receive it in error, notify us, delete it and do not make use of or
copy it.

Internet communications are not secure and therefore Assureweb Limited do not
accept legal responsibility for the contents of this message. Any views or
opinions presented are solely those of the author and do not necessarily
represent those of Assureweb Limited unless otherwise specifically stated.

Current Thread