Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > XML > XSLT
Password Reminder
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old May 10th, 2004, 09:09 AM
Registered User
Join Date: May 2004
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default convert elements based on place in document

hi all,

i have a document with 7 recurring elements, the problem is they all have the same name/attributes.
is there a possibility to 'rename' them according to their place in the document ?
the first element of the recurring cyclus always has the same text. e.g. "start"
sourcefile :
<par>random text1</par>
<par>random text2</par>
<par>random text3</par>
<par>random text4</par>
<par>random text5</par>
endfile :
<element2>random text1</element2>
<element3>random text2</element3>
<element4>random text3</element4>
<element5>random text4</element5>
<element2>random text5</element2>

can this be done in xslt ?
thanx in advance

Reply With Quote
  #2 (permalink)  
Old May 12th, 2004, 08:22 PM
Registered User
Join Date: Apr 2004
Location: Melbourne, FL, .
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts

The short answer is - yes.

Reply With Quote
  #3 (permalink)  
Old May 17th, 2004, 05:32 AM
Registered User
Join Date: May 2004
Location: , , Bulgaria.
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts

Have a look at the generate-id() and key() fumctions.
Then use the xsl:element with parameters generated from the above functions.

Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
accessing elements using document() function geoGregory3 XSLT 2 February 28th, 2008 07:39 PM
Excluding Elements based on a Predicate Condition tasmisr XSLT 3 February 27th, 2008 01:00 PM
Comparing elements in an XML document dlorenz XSLT 0 August 7th, 2007 05:28 PM
convert list of ';' separated values --> elements Condor76 XSLT 1 June 11th, 2007 02:56 PM

All times are GMT -4. The time now is 11:54 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.