|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: namespace-alias problem
xsl:namespace-alias applies only to literal result elements. So if you write
<x:template...>
the namespace will be changed, but if you write
<xsl:element name="x:template"
then it won't.
So you should either change
<xsl:element name="x:template">
to
<xsl:element name="xsl:template">
or you should change
<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>
to
<x:template match="{person}">
<BODY>
This is the body text
<x:apply-templates>
<x:with-param name="path" select="person"/>
</x:apply-templates>
</BODY>
</x:template>
Michael Kay
http://www.saxonica.com/
> -----Original Message-----
> From: Touchtel [mailto:omprakashv@xxxxxxxxxxxxxxxxx]
> Sent: 23 January 2005 05:15
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Subject: namespace-alias problem
>
> 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>
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








