xsl-list
[Top] [All Lists]

RE: [xsl] Generating an XSLT stylesheet with additional namespaces

2006-06-06 00:07:08
In XSLT 2.0, use the xsl:namespace instruction.

In 1.0, there's a workaround:

<xsl:variable name="dummy">
  <xsl:element name="{$prefix}:{$local}" namespace="{$uri}"/>
</xsl:variable>
<xsl:copy-of select="xx:node-set($dummy)//namespace::*"/> 

That is, create an element in the relevant namespace, then copy its
namespace nodes.

Michael Kay
http://www.saxonica.com/

-----Original Message-----
From: Jim Earley [mailto:Jim(_dot_)Earley(_at_)flatironssolutions(_dot_)com] 
Sent: 06 June 2006 00:38
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] Generating an XSLT stylesheet with additional 
namespaces

Hello,

I'm trying to generate a "stub" XSL stylesheet by reading an 
XML Schema file to generate the template matches for all 
declared elements.  The problem I have is that the schema is 
using a default namespace and I want to declare a namespace 
prefix (and the URI) in the generated stylesheet.

For example:

<xsl:template match="/">

      <xsl:element name="xsl:stylesheet">
              <xsl:if test="@targetNamespace">
                      <!--
                              specify the namespace on the 
stylesheet element???
                      -->
              </xsl:if>

              <xsl:for-each select="//xsd:element[(_at_)name]">
                      <xsl:sort select="@name"/>
                      <xsl:apply-templates select="."/>
              </xsl:for-each>
      </xsl:element>
</xsl:template>


How can I specify an "additional" and URI on the root 
xsl:stylesheet element?

Any ideas?

Thanks in advance for your help.

================
Jim Earley
XML Developer/Consultant
Flatirons Solutions
4747 Table Mesa Drive
Boulder, CO 80301

jim(_dot_)earley(_at_)flatironssolutions(_dot_)com 

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--

<Prev in Thread] Current Thread [Next in Thread>