xsl-list
[Top] [All Lists]

RE: [xsl] XSLT Output contains the unwanted content of all elements as text

2007-03-08 08:20:16
If there's no template in your stylesheet that matches a given element, then
the default template kicks in: this outputs the text of the element (without
any tags). Change the default by including

<xsl:template match="*"/>

Michael Kay
http://www.saxonica.com/ 

-----Original Message-----
From: Ramona Krickan [mailto:ramona(_dot_)krickan(_at_)zooplus(_dot_)de] 
Sent: 08 March 2007 14:52
To: 'xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com'
Subject: [xsl] XSLT Output contains the unwanted content of 
all elements as text

Hi,

I got a Problem with my transformation output. My xslt doc 
does the correct transformation but in my output document I 
not only get the expected transformation but also the 
text-content of all the other elements from my source 
document. I don't undestand why. Could somebody please help me?

Here my xslt:
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
xmlns:zoo="http://example.com/ns";>
<xsl:template match="element(zoo:country)"> <xsl:variable 
name="countryCode" select="."/> <xsl:value-of select="if 
($countryCode='CH') then ('AT') else ($countryCode)" /> 
</xsl:template> </xsl:stylesheet> 

My input xml:
<zoo:address xmlns:zoo="http://example.com/ns";>
<zoo:street>Strasse</zoo:street>
<zoo:country>CH</zoo:country>
</zoo:address> 

output document:
Strasse /*this is unexpected*/
AT

Thanks in advance for any help!

Ramona Krickan

zooplus AG
Eichenweg 4a
85774 Unterfoehring
Germany
Tel +49.89.95 00 6-194
Fax +49.89.95 00 6-500
mailto:ramona(_dot_)krickan(_at_)zooplus(_dot_)de
http://www.zooplus.de



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--