Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 6th, 2004, 04:12 AM
Authorized User
 
Join Date: Sep 2004
Posts: 36
Thanks: 0
Thanked 0 Times in 0 Posts
Default Generating XML tags on the fly

I'm in the process of generating a new XML file using an XSL transform. I did wander if it was in the capabilities of XSL to create XML tags on the fly.

Example, my first XML file has:

<PROOFSOFID>
        <TYPEOFPROOF>AB</TYPEOFPROOF>
        <DETAILS>AB details</DETAILS>
</PROOFSOFID>
<PROOFSOFID>
        <TYPEOFPROOF>CD</TYPEOFPROOF>
        <DETAILS>CD Details</DETAILS>
</PROOFSOFID>

I would need my transform to create:

<PROOFID1>AB</PROOFID1>
<PROOFID2>CD</PROOFID2>
and so on.

If I had 4 in my xml file then I would need PROOF1 up to PROOF4.

Is this possible?



 
Old September 6th, 2004, 04:44 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

Sure you can do this, use a construct such as

<xsl:element name="{concat(name(), position()}">

Mind you, it's a pretty strange use of XML markup that you're trying to produce.

Michael Kay
http://saxon.sf.net/
 
Old September 6th, 2004, 05:04 AM
Authorized User
 
Join Date: Sep 2004
Posts: 36
Thanks: 0
Thanked 0 Times in 0 Posts
Default

How would you loop through or count the PROOFSOFID so that you know how many to create?

Thanks for the reply,
Francis



 
Old September 6th, 2004, 05:21 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

I think you should spend some time with a tutorial such as Jeni Tennison's "Beginning XSLT", or the online tutorials at zvon.org or w3schools.org

Michael Kay
http://saxon.sf.net/





Similar Threads
Thread Thread Starter Forum Replies Last Post
Generating ASPX on the fly sandeepbhutani304 ASP.NET 2.0 Basics 0 September 16th, 2008 12:49 AM
Generating XML m_rajib Crystal Reports 0 May 4th, 2006 07:51 AM
Generating anchor tags swwallace XSLT 3 March 8th, 2006 03:05 PM
generating XML through PHP Ashleek007 Beginning PHP 1 January 27th, 2006 08:16 AM
Generating html tags dynamically sachin lad Servlets 1 April 26th, 2005 05:35 PM





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