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

Re: Re: xsl:namespace

Subject: Re: Re: xsl:namespace
From: Jesper Tverskov <jesper.tverskov@xxxxxxxxx>
Date: Sun, 22 Feb 2009 12:28:30 +0100
Re:  Re: xsl:namespace
Thanks.

I have made a stylesheet example illustrating MK's additional use
case. Below, xsl:namespace is used to transfer namespace declarations
from children elements to outermost element in output. This is only
for cosmetic reasons, to clean things up, but very nice.

I have a feeling that for this use case it is only necessary for
dynamically created namespaces.

It seems to me that as long as we can put the proper namespace
declarations in the xsl:stylesheet element, they always show up in the
outermost element of output unless we exclude them?

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output indent="yes"/>
    <xsl:param name="ns-prefix" select="'somePrefix'"/>
    <xsl:param name="ns-namespace" select="'someNamespace'"/>
    <xsl:template name="start" match="/">
        <catalog>
            <xsl:namespace name="{$ns-prefix}" select="$ns-namespace"/>
            <xsl:element name="{$ns-prefix}:product"
namespace="{$ns-namespace}"/>
            <xsl:element name="{$ns-prefix}:product"
namespace="{$ns-namespace}"/>
        </catalog>
    </xsl:template>
</xsl:stylesheet>

Cheers,
Jesper Tverskov

http://www.xmlkurser.dk
http://www.xmlplease.com

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.