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
Conferences Close Tree View
+ Stylus Studio Feature Requests (1192)
- Stylus Studio Technical Forum (14621)
-> - Stylus Studio - Registrar en o... (1)
-> + Stylus Studio - Registrar en o... (2)
-> + Can a pipeline send a file by ... (2)
-> + After Updateing WIN10 to WIN11... (12)
-> + Where do I add the custom java... (3)
-> + Where is the Diagram tab? (5)
-> + Applying XSLT to Word DOCX/XML (2)
-> - CSV conversion via ConvertToXM... (1)
-> + Text symbols in SS not same as... (4)
-> + Exposing xquery as webservice ... (6)
-> + Syntax Identifier (2)
-> + Saving a Converted XML as an X... (5)
-> + Output document cannot be pars... (4)
-> - Archiving output from conversi... (1)
-> + EDIFACT guideline from Stylus ... (3)
-> + CSV file putting all the data ... (5)
-> + Can't install Home version 64b... (5)
-> + presale - Can I covers this sc... (5)
-> + Problem with UNB (5)
-> + Splitting EDIFACT files pipeli... (4)
-- [1-20] [21-40] [41-60] Next
+ Website Feedback (249)
+ XSLT Help and Discussion (7625)
+ XQuery Help and Discussion (2017)
+ Stylus Studio FAQs (159)
+ Stylus Studio Code Samples & Utilities (364)
+ Stylus Studio Announcements (113)
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





   
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.