[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

[xsl] namespace-alias problem


Subject: [xsl] namespace-alias problem
From: "Touchtel" <omprakashv@xxxxxxxxxxxxxxxxx>
Date: Sun, 23 Jan 2005 10:45:16 +0530

Hi,
    Iam using a stylesheet to generate another stylesheet and having some
problems like the processor not recognising the aliased namespace (x:) the
2nd time around. The following are my xml and  and input and output
stylesheet snippets. The snippets are quite large but I am not sure how to
make these smaller than this.

Regards,
Omprakash.V


      school.xml

	<?xml version="1.0" encoding="UTF-8"?>

	<school version="1.0">
	  <student name="person"/>
        <student name="name" type="ps:data"/>
  	</school>


	student.xsl
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:x
="http://www.w3.org/1999/XSL/TransformAlias" exclude-result-prefixes="x"
version="1.0">

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

<xsl:output method="xml" indent="yes" encoding="iso-8859-1"/>

<xsl:template match="school">
    <x:stylesheet version="1.0" xmlns:xsl
="http://www.w3.org/1999/XSL/Transform">
<x:strip-space elements="*"/>

<xsl:element name="x:template">
<xsl:attribute name="match">
<xsl:value-of select="person"/>
</xsl:attribute>

<BODY>
    This is the body text
<x:apply-templates>
 <x:with-param name="path" select="person"/>
</x:apply-templates>
  </BODY>

</xsl:element>

<xsl:apply-templates />

</x:stylesheet>

</xsl:template>

<xsl:template match="student">

<xsl:if test="not(@name='person')">

<xsl:element name="x:template">
<xsl:attribute name="match">
<xsl:value-of select="@name" />
</xsl:attribute>

<a href="#">This is a student <x:value-of select="@name"/></a>
</xsl:element>

</xsl:if>

</xsl:template>

</xsl:stylesheet>












And the resulting stylesheet is

<?xml version="1.0" encoding="iso-8859-1"?>
<x:stylesheet xmlns:x="http://www.w3.org/1999/XSL/Transform" version="1.0">
<x:strip-space elements="*"/>
<x:template xmlns:x="http://www.w3.org/1999/XSL/TransformAlias" match="">
<BODY>
    This is the body text
<x:apply-templates>
<x:with-param name="" select=""/>
</x:apply-templates>
</BODY>
</x:template>


     <x:template xmlns:x="http://www.w3.org/1999/XSL/TransformAlias"
match="name">

<a href="#">This is a student <x:value-of
xmlns:x="http://www.w3.org/1999/XSL/Transform" select="@name"/>
</a>
</x:template>
  </x:stylesheet>


Current Thread
Keywords
xml