xsl-list
[Top] [All Lists]

namespaces problem - two transformations in one stylesheet possible?

2006-02-06 05:59:44
Hi there,

I have a problem with (unqualified) namespaces in the xml to be transformed 
that is preventing a transformation from working. I understand that is is 
possible to use a transformation to remove the namespaces, and then the result 
of this can then be transformed. However the architecture that we are using 
does not make it easy to use two stylesheets where one would normally have been 
expected.

Can I ask if it is therefore possible either to perform two transformations on 
the one stylesheet (i.e. to transform the incoming xml, and then transform the 
result of this first transformation), or alternatively is it possible to 
reference a second stylesheet in the first and then pass the result of the 
first stylesheet to a second one?

A code example:

Incoming message (I have no control over this):

<?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>

The existing stylesheet is something like the following:

<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">
        <xsl:output method="xml" indent="yes" omit-xml-declaration="no"/>       
        <xsl:template match="/">
                <xsl:apply-templates select="message"/>
        </xsl:template>
        <xsl:template match="message">
                <xsl:apply-templates select="m_content"/>
        </xsl:template>
        <xsl:template match="m_content">
                <quotation dtd-version="1.0">
                        <versn>2.0</versn>
                        <xsl:call-template name="control"/>
                        <!-- assorted other templates -->
                </quotation>
        </xsl:template>
        <!--  Quotes/control -->
        <xsl:template name="control">
                <!-- etc lots more xsl here -->
        </xsl:template>
</xsl:stylesheet>

As stated the stylesheet does not like the namespace and fails to transform as 
expected, and we are currently very limited by our architecture as to what we 
can do about this. Any help or advice with this is much appreciated.

Andrew Ballantine

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.

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--