Bhupendra Mehta

Greenhorn
+ Follow
since Oct 29, 2004
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Bhupendra Mehta

Part 2 of the XSL

This code works for about 1000 - 1200 iterations but beyond that I get a StackOverFlow. Thanks for your help and I apologize for the lengthy content.
Here is part of the XSL file.

Continued....
I have to send these in multiple posts.

Here is the input XML.

XML 1 (input.xml) where I need to replicate the node content-node with attr create-type="implicit" with data populated from userinfo.xml. All other nodes need to be copied as is.


XML2 (userinfo.xml) is the xml which holds user data to be used while replicating the node.
Paul Is there an email I can email you my xmls & xsl
Here is the code which I believe is causing the recursive looping ... this is where I loop through all the users in the users.xml (XML 2)


I guess I'm looking for a better way to loop through all the records in XML 2 without having to do a recursive loop like above.

Thanks for your response
Assume node2 from XML 1 as a template for the node I am trying to replicate. The attribute values for that node/children viz sub-node2/@attr3 and sub-node3/@attr are to be picked up from XML 2 (dynamic values) based on some condition. Lets say sub-node2/@attr3 will be populated by users/user/@name.

Hope this better explains it. Thanks.
What I mean is that these are two separate files. for e.g. data.xml (XML 1) and users.xml (XML 2) just means of labelling.
I need to replicate a node from an XML with attribute values read from another XML file. Both the input XMLs are huge aprrox 10 - 50 M. What is the best way to accomplish this. With my current stylesheet I get a Stackoverflow error for records over 1400. Here is a sample XML



obviously the dynamic values are read from XML 2.

Thanks for any response.


Edit Comment: Close the code tag.

- m
[ February 15, 2006: Message edited by: Madhav Lakkapragada ]
Madhav,
Thanx a lot that worked like a charm.
Madhav,
Thanx for the suggestion but i can't get the substring'd value. This is what I changed the rule to

<xsl:variable name="distinctdate" select="//row[not(substring(col[1],1,7)=substring(preceding-sibling::row/col[1],1,7))]/col[1]"></xsl:variable>

but I can't substring the final value that I'm retrieving //row[condition]/col[1]

Thanx again.
I have an xml of the form
<data>
<row>
<col>2003-05-04</col>
</row>
<row>
<col>2003-05-07</col>
</row>
<row>
<col>2003-05-04</col>
</row>
<row>
<col>2003-05-08</col>
</row>
<row>
<col>2004-06-08</col>
</row>
<row>
<col>2004-07-08</col>
</row>
.
.
.
</data>
The col element has dates in the form of yyyy-mm-dd. I am trying to find distinct yyyy-mm values from the above XML in a "variable". I can get distinct date values by using
<xsl:variable name="distinctdate" select="//row[not(col[1]=preceding-sibling::row/col[1])]/col[1]"></xsl:variable>
which gives me
2003-05-04
2003-05-07
2003-05-08
2004-06-08
2004-07-08

but what i'd really like is
2003-05
2004-06
2004-07
Any reponses will be greatly appreciated. Thanx