Re: [xslt] Problem with creating namespace in the stylesheet



On Wed, Sep 22, 2004 at 12:44:05PM +0200, Jirka Kosek wrote:
> >Is it possible to create as a output the XSLT stylesheet with some
> >namespace? (Not if namespace is defined in the processed XSLO stylesheet)
> 
> You probably want to create some elements or attributes in a given 
> namespace. So go ahead and create such element and attributes. XSLT 
> processor will add all necessary namespace declarations for you.
> 
> 				Jirka

That is problem, because I don't know this namespace - it is parsed from the
processing XML document. Exactly the situation is:

<xsl:stylesheet version="1.0"
 xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
 xmlns:xslo="http://www.w3.org/1999/XSL/TransformAlias";
 xmlns:schema="http://relaxng.org/ns/structure/1.0";>

<xsl:import href="relaxng-core.xsl"/>
<xsl:output method="xml" encoding="iso-8859-1" indent="yes"/>
<xsl:strip-space elements="*"/>
<xsl:namespace-alias stylesheet-prefix="xslo" result-prefix="xsl"/>

<xsl:template match="/">
	<!-- Now I take the namespace -->
	<xsl:variable name="netopeerns" value="schema:grammar/@ns"/>

	<!-- Now I create the <xslo:stylesheet> element -->
	<xsl:element name="xslo:element">
		<!-- Now it is created the <xslo:stylesheet> element. I need to add the namespace to it with "netopeer" prefix and the same value as the value of the $netopeerns is -->
		<!-- e.g., if the value of the $netopeer variable is "http://www.liberouter.org";, I need to obtain output as a: <xslo:stylesheet xmlns:netopeer="http://www.liberouter.org"/> -->

		<!-- Processing the rest of the document... -->
	</xsl:element>
</xsl:template>

</xsl:stylesheet>

Is it understandable?

Petr N.
-- 

Petr Novak, Liberouter Project (www.liberouter.org)
E-mail: novak merlot ics muni cz



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]