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
Conferences Close Tree View
+ Stylus Studio Feature Requests (1192)
- Stylus Studio Technical Forum (14621)
-> + First steps in XSLT mapping (4)
-> + Option to build XSL-FO is not ... (3)
-> + using Adaptor convert XML to e... (2)
-> + Using XML Converter on a Compl... (2)
-> + Java built-in processor needed... (3)
-> + XSL to draw a table (2)
-> - Stylus Studio in c# solutions (1)
-> + entities within schemaLocation... (4)
-> + java runtime error during xslt... (2)
-> + Conversion of XML Doc for RSS ... (2)
-> + Does anyone know how to upgrad... (2)
-> + XML editor corrupts my file (5)
-> + Stylus Studio & Berkeley DB XM... (4)
-> + XSLT for page breakout (2)
-> - How to avoid creating empty el... (2)
-> ->How to avoid creating emp...
-> + Error in converting 945 EDI us... (4)
-> + XML to X12 (invoice 810 edi) (2)
-> - Stylus Studio 2009 Enterprise ... (1)
-> + Stylus Studio 2007 - license d... (2)
-> + XML to X12 conversion error (6)
-- Previous [721-740] [741-760] [761-780] Next
+ Website Feedback (249)
+ XSLT Help and Discussion (7625)
+ XQuery Help and Discussion (2017)
+ Stylus Studio FAQs (159)
+ Stylus Studio Code Samples & Utilities (364)
+ Stylus Studio Announcements (113)
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

   
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.