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 Go to previous topicPrev TopicGo to next topicNext Topic
Postnext
Stefan MulderSubject: Remove unnecessary TAGS in generated XML file using XSLT
Author: Stefan Mulder
Date: 23 Dec 2004 07:41 AM
Originally Posted: 21 Dec 2004 04:30 AM
Hello, within Siebel I've configured a Workflow process in which attached "transform.xsl" is called to get rid of abundant TAGS. Does anybody know how I do have to adjust the attached "transform.xsl" to get rid of abundant TAGS like <CONSUMER_PHONE />, <CONSUMER_ADDRESS /> and <CONSUMER_PRODUCT /> when no such data is present (see attached "siebel_exp_23dec2004_5.xml") ? Thanks a lot for your help/suggestions given on this one. Kind regards, Stefan


Unknownsiebel_exp_23dec2004_5.xml
siebel_exp_23dec2004_5.xml

Unknowntransform(5).xsl
transform.xsl

Postnext
James DurningSubject: Remove unnecessary TAGS in generated XML file using XSLT
Author: James Durning
Date: 22 Dec 2004 05:47 PM
There's two ways I've used:
eg. let's look at:
<SOURCE_SYSTEM_CODE>
<xsl:value-of select="CONSUMER_FILE/CONSUMER/SOURCE_SYSTEM_CODE"/>
</SOURCE_SYSTEM_CODE>
Method 1:
<xsl:for-each select="CONSUMER_FILE/CONSUMER/SOURCE_SYSTEM_CODE[.!='']">
<SOURCE_SYSTEM_CODE>
<xsl:value-of select="."/>
</SOURCE_SYSTEM_CODE>
</xsl:for-each>
Method 2:
<xsl:if test="CONSUMER_FILE/CONSUMER/SOURCE_SYSTEM_CODE !=''">
<SOURCE_SYSTEM_CODE>
<xsl:value-of select="CONSUMER_FILE/CONSUMER/SOURCE_SYSTEM_CODE"/>
</SOURCE_SYSTEM_CODE>
</xsl:if>

Other suggestions:
Everytime you call those xpaths, the processor has to go down the tree and then back up to the root, down the tree then back up to the root again....
You might want to consider changing context to speed it up.
For example changing your template to:
<xsl:template match="/CONSUMER_FILE">
will give you a small speed increase.

Another example:
<xsl:for-each select="/CONSUMER_FILE/CONSUMER">
<SOURCE_SYSTEM_CODE>
<xsl:value-of select="SOURCE_SYSTEM_CODE"/>
</SOURCE_SYSTEM_CODE>
<LOCAL_CONSUMER_ID>
<xsl:value-of select="LOCAL_CONSUMER_ID"/>
</LOCAL_CONSUMER_ID>
<FAMILY_NAME_OF_PERSON>
<xsl:value-of select="FAMILY_NAME_OF_PERSON"/>
</FAMILY_NAME_OF_PERSON>
</xsl:for-each>

Postnext
James DurningSubject: Remove unnecessary TAGS in generated XML file using XSLT
Author: James Durning
Date: 22 Dec 2004 06:36 PM
wait, are you simply copying elements?
If so you're doing too much work...

Difference between 2 files:
transform2.xsl checks for nested elements, with no values

eg. if you had
<a>
<b>
<c/>
</b>
<d>value</d>
</a>

transform2 would remove both c and b.
I don't know whether you need to check for that case.


Documenttransform2.xsl
filtered copy checking nesting

Unknowntransform(2).xsl
filtered copy

Posttop
Stefan MulderSubject: Remove unnecessary TAGS in generated XML file using XSLT
Author: Stefan Mulder
Date: 24 Dec 2004 02:20 AM
Howdy,

I see you changed the question before I got a chance to send this --
and you added the recursiveness. Great.

As for the tags, you would have to add some logic to see if the tag was
empty first before doing the copy. Something like

<xsl:if test="boolean(CONSUMER_PHONE/node())"><xsl:copy-of
select="CONSUMER_PHONE"/></xsl:if>

might work. It's been a while since I've done a test like that, but
that's the basic idea.

Noah Mittman <noah@teradome.com>

 
Topic Page 1 2 3 4 5 6 7 8 9 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.