Subject: RE: [xsl] namespace-alias problem From: "Michael Kay" <mike@xxxxxxxxxxxx> Date: Sun, 23 Jan 2005 16:37:11 -0000 |
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: [xsl] 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>
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] namespace-alias problem, Geert Josten | Thread | [xsl] Determine last element before, gerritjan |
[xsl] how xslt2 affects usage of pr, Bryan Rasmussen | Date | RE: [xsl] Determine last element be, Michael Kay |
Month |