[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Namespace attached to host doc rather than payload

Subject: Re: Namespace attached to host doc rather than payload
From: david_n_bertoni@xxxxxxxxxx
Date: Tue, 17 Jun 2003 22:48:58 -0700
xsltransform namespace



> To be conformant with the specification I am trying to meet, the
namespace of
> the payload document must appear on the "payload" element as above.
However,
> when I run a stylesheet transformation on the document (using .NET 1.1
> System.Xml.Xsl.XslTransform) the namespace is moved to top-level
> "ListRecords" element.

Just out of curiousity, is there a reason why the specification imposes
this requirement?

> <?xml version="1.0" encoding="UTF-8"?>
> <xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0"
> xmlns:q="http://www.example.com/queue/" exclude-result-prefixes="q"
> xmlns:x="http://www.example.com/ex/">
> <xsl:output method="xml" omit-xml-declaration="yes" />

Because the namespace declaration for x appears on the stylesheet element,
every literal result element in your stylesheet has a copy of that
namespace node:

   http://www.w3.org/TR/xslt#literal-result-element

   "The created element node will also have a copy of the namespace nodes
   that were present on the element node in the stylesheet tree with the
   exception of any namespace node whose string-value is the XSLT namespace
   URI (http://www.w3.org/1999/XSL/Transform), a namespace URI declared as
   an extension namespace (see [14.1 Extension Elements]), or a namespace
   URI designated as an excluded namespace."

So, if you move it to the x:one and x:two literal result elements, that
should solve the problem:

   <xsl:template match="q:one">
     <x:one xmlns:x="http://www.example.com/ex/">
       <xsl:value-of select="." />
     </x:one>
   </xsl:template>

   <xsl:template match="q:two">
     <x:two xmlns:x="http://www.example.com/ex/">
       <xsl:value-of select="." />
     </x:two>
   </xsl:template>

You could also use xsl:element to generate these two elements, since
xsl:element will not generate namespace nodes in the same way that a
literal result element will.

After modifying your stylesheet, Xalan-C 1.5 produces the output you
require.  I suspect msxsl will as well.

Dave


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.