RE: [xsl] Why do the namespace appears in transformation ?

Subject: RE: [xsl] Why do the namespace appears in transformation ?
From: "Fabien Tillier" <f.tillier@xxxxxxxx>
Date: Fri, 20 Aug 2010 10:21:08 +0200
Brilliant !
I get three clear answers on my question ! thank you very much to David,
Michael and Hermann for the explanations and solutions provided.
I now understand things a bit better :)

Best regards,
Fabien


On 20/08/2010 07:53, Fabien Tillier wrote:
> Hi List.
> I am trying to generate an XSL template from an XML file that
describes
> some filters.
> So, basically, I get
> <Results>
>     <Row>
>        <MTF_NUMERO_TABLEAU>2</MTF_NUMERO_TABLEAU>
>        <TA_TITRE_A>Titre 1</TA_TITRE_A>
>     </Row>
>     <Row>
>        <MTF_NUMERO_TABLEAU>3</MTF_NUMERO_TABLEAU>
>        <TA_TITRE_A>Titre 2</TA_TITRE_A>
>     </Row>
>   </Results>
>
> I am parsing it with (not finished, of course)
>
> <?xml version="1.0" encoding="UTF-8"?>
> <xsl:stylesheet version="2.0"
>   xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
> exclude-result-prefixes="xsl"
>   xmlns:xso="dummy"
>    >
>   <xsl:output method = "xml" encoding="UTF-8"/>
>   <!--  When transforming, all xso namespace elements will become xsl
-->
>   <xsl:namespace-alias stylesheet-prefix="xso" result-prefix="xsl"/>
>   <xsl:template match="/Results">
>   	<xsl:for-each-group select="Row" group-by="MTF_NUMERO_TABLEAU">
>   		<xsl:variable name="numtableau">
>   			<xsl:value-of select="current-grouping-key()"/>
>   		</xsl:variable>
>   		<xso:template match="node()[(MTF_NUMERO_TABLEAU =
> '{$numtableau}')]">
>   			<!--Do something-->
>   		</xso:template>
> 		<xsl:value-of select="current-grouping-key()"/>,
>
> 	</xsl:for-each-group>
>   </xsl:template>
>   <xsl:template match="Row">
>
>   </xsl:template>
> </xsl:stylesheet>
>
>
>
> The output (with Kernow) is
>
> <?xml version="1.0" encoding="UTF-8"?>
> <xsl:template xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
> match="node()[(MTF_NUMERO_TABLEAU = '2')]"/>2,
> <xsl:template xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
> match="node()[(MTF_NUMERO_TABLEAU = '3')]"/>3
>
> Which is almost what I want....
> But, how can I get rid of the xmlns declaration in each<xsl:template
> section ?
> (So that to get
> <?xml version="1.0" encoding="UTF-8"?>
> <xsl:template match="node()[(MTF_NUMERO_TABLEAU = '2')]"/>2,
> <xsl:template match="node()[(MTF_NUMERO_TABLEAU = '3')]"/>3
> )
>
> Thanks in advance
> Regards,
> Fabien

Current Thread