XML Editor
Sign up for a WebBoard account Sign Up Keyword Search Search More Options... Options
Chat Rooms Chat Help Help News News Log in to WebBoard Log in Not Logged in
Show tree view Topic
Topic Page 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 Go to previous topicPrev TopicGo to next topicNext Topic
Posttop
Neal  WaltersSubject: XSLT: The namespace prefix is not allowed to start with the reserved string "xml".
Author: Neal Walters
Date: 08 Dec 2004 11:38 AM

1) I created an XSLT using this file as input and output:

<?xml version="1.0" encoding="UTF-8"?>
<AmazonEnvelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:amzn="http://www.amazon.com/XSL/Transform/Extensions" xsi:noNamespaceSchemaLocation="amzn-envelope.xsd">
<Header>
<DocumentVersion>1.01</DocumentVersion>
<MerchantIdentifier>ABC</MerchantIdentifier>
</Header>
</AmazonEnvelope>

2) I connect DocumentVersion and MerchantIdentifier using the XSLT:Mapper,
run it and I do see my output, but with no namespaces.

The first XSLT looks like this:

<?xml version='1.0' ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<AmazonEnvelope>
<Header>
<DocumentVersion>
<xsl:value-of select="AmazonEnvelope/Header/DocumentVersion"/>
</DocumentVersion>
<MerchantIdentifier>
<xsl:value-of select="AmazonEnvelope/Header/MerchantIdentifier"/>
</MerchantIdentifier>
</Header>
</AmazonEnvelope>
</xsl:template>
</xsl:stylesheet>

3) So now I want to copy the namespace info from the source XML to the target XML.
If I use the mapper to connect wither of xmlns:xsi or xmlns:amzn, and run it, I get the error:
The browser view of output says:
The namespace prefix is not allowed to start with the reserved string "xml".

The output xml looks like this:
<?xml version='1.0' ?>
<AmazonEnvelope xmlns:xmlns="http://www.w3.org/2000/xmlns/"
xmlns:amzn="">
<Header>
<DocumentVersion>1.01</DocumentVersion>
<MerchantIdentifier>ABC</MerchantIdentifier>
</Header>
</AmazonEnvelope>

The XSLT now looks like this:
<?xml version='1.0' ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xmlns="http://www.w3.org/2000/xmlns/">
<xsl:template match="/">
<AmazonEnvelope>
<xsl:attribute name="xmlns:amzn">
<xsl:value-of select="AmazonEnvelope/@xmlns:amzn"/>
</xsl:attribute>
<Header>
<DocumentVersion>
<xsl:value-of select="AmazonEnvelope/Header/DocumentVersion"/>
</DocumentVersion>
<MerchantIdentifier>
<xsl:value-of select="AmazonEnvelope/Header/MerchantIdentifier"/>
</MerchantIdentifier>
</Header>
</AmazonEnvelope>
</xsl:template>
</xsl:stylesheet>

4) My get around for now is to change the XSLT manually instead of using the mapper,
I just added the namespaces on the AmazonEnvelope tag below.

<?xml version='1.0' ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<AmazonEnvelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:amzn="http://www.amazon.com/XSL/Transform/Extensions" xsi:noNamespaceSchemaLocation="amzn-envelope.xsd">
<Header>
<DocumentVersion>
<xsl:value-of select="AmazonEnvelope/Header/DocumentVersion"/>
</DocumentVersion>
<MerchantIdentifier>
<xsl:value-of select="AmazonEnvelope/Header/MerchantIdentifier"/>
</MerchantIdentifier>
</Header>
</AmazonEnvelope>
</xsl:template>
</xsl:stylesheet>

5) So my question is - should I be able to connect the namespaces
using the mapper?

Stylus Studio 6.0 Build 212e

Thanks in advance,
Neal Walters
http://Biztalk-Training.com - Free Biztalk Demos





 
Topic Page 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 Go to previous topicPrev TopicGo to next topicNext Topic
Download A Free Trial of Stylus Studio 6 XML Professional Edition Today! Powered by Stylus Studio, the world's leading XML IDE for XML, XSLT, XQuery, XML Schema, DTD, XPath, WSDL, XHTML, SQL/XML, and XML Mapping!  
go

Log In Options

Site Map | Privacy Policy | Terms of Use | Trademarks
Stylus Scoop XML Newsletter:
W3C Member
Stylus Studio® and DataDirect XQuery ™are from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2016 All Rights Reserved.