[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: XSLT Output contains the unwanted content of all

Subject: RE: XSLT Output contains the unwanted content of all elements as text
From: cknell@xxxxxxxxxx
Date: Thu, 08 Mar 2007 10:00:27 -0500
RE:  XSLT Output contains the unwanted content of all
XSLT will output the text content of nodes not matched by a template, that's what you've got. If you want to "throw away" the content of one or more elements, you need a null-ouput template. In your case, add this template to your stylesheet.

<xsl:template match="zoo:street" />

-- 
Charles Knell
cknell@xxxxxxxxxx - email



-----Original Message-----
From:     Ramona Krickan <ramona.krickan@xxxxxxxxxx>
Sent:     Thu, 8 Mar 2007 15:52:29 +0100
To:       "'xsl-list@xxxxxxxxxxxxxxxxxxxxxx'" <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
Subject:   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.krickan@xxxxxxxxxx
http://www.zooplus.de

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.