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
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.

 
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.