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

Re: a very unusual namespace question

Subject: Re: a very unusual namespace question
From: Steve Tinney <stinney@xxxxxxxxxxxxx>
Date: Thu, 17 May 2001 21:06:45 -0400
very unusual names
Something like this, maybe?

A.xsl:
====

<xsl:stylesheet version="1.0" 
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  xmlns:axsl="http://www.w3.org/1999/XSL/TransformAlias">

<xsl:param name="ns" select="'anyns'"/>
<xsl:param name="ns-uri" select="'http://www.whatever.uri'"/>

<xsl:output method="xml"/>

<xsl:namespace-alias stylesheet-prefix="axsl" result-prefix="xsl"/>

<xsl:template match="/">
  <xsl:text disable-output-escaping="yes">
&lt;!DOCTYPE axsl:stylesheet [
&lt;!ATTLIST axsl:stylesheet xmlns:</xsl:text>
<xsl:value-of select="$ns"/>
<xsl:text> CDATA #FIXED "</xsl:text>
<xsl:value-of select="$ns-uri"/>
<xsl:text>"&#xa;</xsl:text>
<xsl:text>xmlns</xsl:text>
<xsl:text> CDATA #FIXED "</xsl:text>
<xsl:value-of select="$ns-uri"/>
<xsl:text>"</xsl:text>
<xsl:text disable-output-escaping="yes">
>]>
</xsl:text>
<axsl:stylesheet version="1.0">
  <axsl:template match="{$ns}:*">
    <axsl:element name="{$ns}:node"/>
  </axsl:template>
</axsl:stylesheet>
</xsl:template>

</xsl:stylesheet>

===============================================

With Saxon 6.3 (YMMV with other processors in terms of escaping
and line-breaking) this generates (reformatted for aesthetic purposes
only):

B.xsl:
====

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE axsl:stylesheet [
<!ATTLIST axsl:stylesheet
   xmlns:anyns CDATA #FIXED "http://www.whatever.uri"
   xmlns CDATA #FIXED "http://www.whatever.uri"
>]>
<axsl:stylesheet 
  xmlns:axsl="http://www.w3.org/1999/XSL/Transform" 
  xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
  version="1.0">
<axsl:template match="anyns:*">
  <axsl:element name="anyns:node"/>
</axsl:template>
</axsl:stylesheet>

================================================

If you feed B.xsl this 

test.xml:
======

<anyns:rootNode xmlns:anyns="http://www.whatever.uri"/>

You get back

out.xml:
======

<?xml version="1.0" encoding="utf-8"?>
<anyns:node xmlns:anyns="http://www.whatever.uri"/>

=======

 Steve

On Thursday 17 May 2001 07:56 pm, you wrote:
> I have a stylesheet A that is outputting stylesheet B (using
> xsl:namespace-alias'ing).  Stylesheet B will be matching elements from
> namespace N so it must have a namespace declaration for N.  But the problem
> is that namespace N is not known at the time I construct A and does not
> appear in the input to A.  I would like to pass the prefix and URI for N to
> stylesheet A as top-level parameters.  How can I get stylesheet A to
> generate a namespace declaration in B from the parameters?  Thanks!
>
>
>
>
>  XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list

 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.