XML Editor
Sign up for a WebBoard account Sign Up Keyword Search Search More Options... Options
Chat Rooms Chat Help Help News News Log in to WebBoard Log in Not Logged in
Show tree view Topic
Topic Page 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 Go to previous topicPrev TopicGo to next topicNext Topic
Postnext
naveen venkatSubject: How to avoid creating empty elements in XSLT
Author: naveen venkat
Date: 04 Sep 2009 10:36 AM
Hello

I am new to XSLT.

When I use Stylus studio mapper to map node1 from the source XML to
node in destination, i get the following XSLT segment.

<node>
<xsl:value-of select="node1"/>
</node>


How do I avoid node element being created if the node1 is empty or does not exist.

I can use <xsl:if> function, but I have around 400 elements and I would like to avoid doing that.

Appreciate your inputs

Thanks

Posttop
(Deleted User) Subject: How to avoid creating empty elements in XSLT
Author: (Deleted User)
Date: 14 Sep 2009 11:38 AM
Hi,
if you don't want to add the xsl:if statements you should postprocess the resulting XML with another XSLT stylesheet that strips all the nodes with no content (i.e. an identity transformation with an empty template for the nodes that you know that should be stripped)

Hope this helps,
Alberto

 
Topic Page 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 Go to previous topicPrev TopicGo to next topicNext Topic
Download A Free Trial of Stylus Studio 6 XML Professional Edition Today! Powered by Stylus Studio, the world's leading XML IDE for XML, XSLT, XQuery, XML Schema, DTD, XPath, WSDL, XHTML, SQL/XML, and XML Mapping!  
go

Log In Options

Site Map | Privacy Policy | Terms of Use | Trademarks
Stylus Scoop XML Newsletter:
W3C Member
Stylus Studio® and DataDirect XQuery ™are from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2016 All Rights Reserved.