Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 27th, 2009, 12:31 PM
Friend of Wrox
 
Join Date: Jan 2006
Posts: 131
Thanks: 10
Thanked 0 Times in 0 Posts
Default Incorrect Namespace output

Hi,

I am referencing the following namespaces in the top of my XSLT and am having difficulty getting the correct output further into my code.

XSLT NS references
Code:
 
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:msg="http://schemas.microsoft.com/dynamics/2006/02/documents/Message" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:si="http://schemas.microsoft.com/dynamics/2006/02/documents/SalesInvoice" xmlns:js-function="//CALjs-functions">
My XSLT transformation code is:
Code:
 
<xsl:element name="InvoiceHeader">
<xsl:attribute name="fo:noNamespaceSchemaLocation"><xsl:text>http://www.w3.org/1999/XSL/Format</xsl:text></xsl:attribute>

...
...
...
 
</xsl:element>
The required output is:
Code:
<InvoiceHeader xmlns:fo="http://www.w3.org/1999/XSL/Format"
/>
But I'm getting:
Code:
<InvoiceHeader xmlns:fo="http://www.w3.org/1999/XSL/Format" fo:noNamespaceSchemaLocation="http://www.w3.org/1999/XSL/Format"/>


Can anyone help please?

Thanks in advance,
__________________
Neal

A Northern Soul
 
Old May 27th, 2009, 12:50 PM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

First I suggest you use literal result elements rather than xsl:element. Then you just need to write:

<InvoiceHeader>

so long as you add exclude-result-prefixes="msg si" (for example) to the xsl:stylesheet element, listing all prefixes that you have declared but do not want to appear in the output.

I'm afraid I'm at a complete loss to understand why you thought that outputting an attribute with name fo:noNamespaceSchemaLocation would not cause an attribute of that name to be output.
__________________
Michael Kay
http://www.saxonica.com/
Author, XSLT 2.0 and XPath 2.0 Programmer\'s Reference





Similar Threads
Thread Thread Starter Forum Replies Last Post
Incorrect syntax near '.' meraj ADO.NET 6 February 27th, 2012 01:01 AM
Need to convert an existing namespace and add new namespace to the SOAP xml Prabeen XSLT 10 April 28th, 2009 10:18 AM
Namespace Output iceandrews XSLT 1 January 14th, 2009 12:14 PM
Remove namespace from output file jopet25 XSLT 12 March 9th, 2007 11:12 AM
Incorrect syntax...... Adam H-W Classic ASP Databases 8 June 21st, 2004 11:14 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.