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)
+ Website Feedback (249)
- XSLT Help and Discussion (7625)
-> + Use of before and after string (3) Sticky Topic
-> - How do I substitute element ty... (1)
-> + How does one add working days ... (4)
-> - Help, I have existing XLT and... (1)
-> + Need help on XSLT issue - (2)
-> + EDI to XML Conversion (7)
-> - XML To JSON Conversion using X... (1)
-> + Formatting Paragraphs to same ... (2)
-> - Grouping of records (1)
-> + Problems with xsd 1.1 (4)
-> + XML to HL7 mapping (3)
-> + XSLT 3 and Iterate (2)
-> + XSL-FO to PDF preview (3)
-> + java.lang.RuntimeException: Er... (2)
-> + Create Acroforms with Stylus X... (2)
-> + How to change XSLT parameter s... (3)
-> + how to change format of the da... (2)
-> + Search "Next 8 Results " doesn... (2)
-> - Support for Git (1)
-> + newbee (8)
-- [1-20] [21-40] [41-60] Next
+ XQuery Help and Discussion (2017)
+ Stylus Studio FAQs (159)
+ Stylus Studio Code Samples & Utilities (364)
+ Stylus Studio Announcements (113)
Topic  
Postnext
Jeff  BerneySubject: Shed some light PLEASE!!!!!!!
Author: Jeff Berney
Date: 11 May 2007 10:37 PM
Hello All,
I have an XML that looks like this
<Table>
<node6>11111,22222,33333</node1>
</Table>
I want to substring the comma and use that as an attribute..kinda like this..
<MyNode id='111111' />
<MyNode id='22222' />
<MyNode id='33333' />

here's my code..
<PolicyDetail> <xsl:call-template name="splitbycomma">
<xsl:with-param name="string" select="PolicyDetailsID"/>
<xsl:with-param name="lobstring" select="LOBID"/>
</xsl:call-template>
</PolicyDetail>

<xsl:template name="splitbycomma">
<xsl:param name="string"/>
<xsl:param name="lobstring"/>
<xsl:element name="PolicyDetail">
<xsl:choose>
<xsl:when test="contains($string,',')">
<xsl:attribute name="pdid">
<xsl:value-of select="substring-before($string,',')"/>
</xsl:attribute>
<xsl:attribute name="lobid">
<xsl:value-of select="substring-before($lobstring,',')"/>
</xsl:attribute>

<xsl:call-template name="splitbycomma">
<xsl:with-param name="string" select="substring-after($string,',')"/> </xsl:call-template>
</xsl:when>
</xsl:choose>
</xsl:element>

</xsl:template>
Now I just get an ifinite loop.. i dont know what i'm doing wrong. Is there a way to get out of this or another way to work around this..please help..thanks jeff

Postnext
Elias HuterSubject: Shed some light PLEASE!!!!!!!
Author: Elias Huter
Date: 14 May 2007 06:35 AM
A usable XML Source file would help.

Postnext
Jeff  BerneySubject: Shed some light PLEASE!!!!!!!
Author: Jeff Berney
Date: 14 May 2007 01:28 PM
Originally Posted: 14 May 2007 01:27 PM
here's the source..

<NewDataSet>
<Table>
<CampaignID>1</CampaignID>
<ClientID>3002</ClientID>
<PolicyID>9852</PolicyID>
<ClientNameID/>
<ClientLocationID/>
<AssignmentPeopleID/>
<PolicyId>12346</PolicyId>
<LOBID>50,54,66</LOBID>
<PolicyDetailsID>11111,22222,33333</PolicyDetailsID>
<ContactPeopleID></ContactPeopleID>
</Table>
<Table>
<CampaignID>1</CampaignID>
<ClientID>3004</ClientID>
<PolicyID>9855</PolicyID>
<ClientNameID/>
<ClientLocationID/>
<AssignmentPeopleID/>
<PolicyId>00095</PolicyId>
<LOBID>12,26,66</LOBID>
<PolicyDetailsID>40150,40151,40152</PolicyDetailsID>
<ContactPeopleID/>
</Table>
</NewDataSet>

Postnext
Elias HuterSubject: Shed some light PLEASE!!!!!!!
Author: Elias Huter
Date: 15 May 2007 09:36 AM
So whats your desired result?

<LOBID>50,54,66</LOBID>
<PolicyDetailsID>11111,22222,33333</PolicyDetailsID>

should be something like?

<Policy>
<PolicyID>9852</PolicyID>
<PolicyDetail pdid=11111 lobid=50/>
<PolicyDetail pdid=22222 lobid=54/>
<PolicyDetail pdid=33333 lobid=60/>
</Policy>

Postnext
Elias HuterSubject: Shed some light PLEASE!!!!!!!
Author: Elias Huter
Date: 15 May 2007 09:47 AM
If so try this one:


Documentattributes.xsl
Example

Postnext
Jeff  BerneySubject: Shed some light PLEASE!!!!!!!
Author: Jeff Berney
Date: 15 May 2007 01:47 PM
Thanks Elias...That did it.. but i get something like xsl processor might detect an infinite loop...what does that mean?


Posttop
Elias HuterSubject: Shed some light PLEASE!!!!!!!
Author: Elias Huter
Date: 16 May 2007 02:35 AM
I'm not sure, maybe google helps.

But what I think is that the parser recognizes that the template calls itself, and under the wrong circumstances (imagine you forget to implement the increasment of the counter) there could be an infinite loop. But as the parser can't analyse the whole logic it just warns you so you can check.

   
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.