Connecting Tech Pros Worldwide Help | Site Map

[Newbie] for-each in template, or?

  #1  
Old September 29th, 2008, 02:05 PM
John Larson
Guest
 
Posts: n/a
Hi all,


I am trying to construct a simple table from XML files using XSLT. I would
like to put an ID from the document in column 1, and the content of some
elements that maybe repeated in column 2. Can this be done in a template
using a for-each, or should I use a sort of variable, or?

Desired output:

7817471 author1

7817471 author2

7817471 author3

7817472 author1

7817472 author2



the ID of each document would be in /inspec/article/contg/accn

and the repeated elements in e.g., /inspec/article/bibliog/aug/pname

Thanks for any help!

- John


  #2  
Old September 29th, 2008, 02:25 PM
Martin Honnen
Guest
 
Posts: n/a

re: [Newbie] for-each in template, or?


John Larson wrote:
Quote:
I am trying to construct a simple table from XML files using XSLT. I would
like to put an ID from the document in column 1, and the content of some
elements that maybe repeated in column 2. Can this be done in a template
using a for-each, or should I use a sort of variable, or?
>
Desired output:
>
7817471 author1
>
7817471 author2
>
7817471 author3
>
7817472 author1
>
7817472 author2
>
>
>
the ID of each document would be in /inspec/article/contg/accn
>
and the repeated elements in e.g., /inspec/article/bibliog/aug/pname
Can you post the XML you want to process? Based on the above I would
guess you might want
<xsl:for-each select="/inspec/article/bibliog/aug/pname">
<xsl:value-of select="concat(../../../contg/accn, ' ', .,
' ')"/>
</xsl:for-each>


--

Martin Honnen
http://JavaScript.FAQTs.com/
Closed Thread


Similar Threads
Thread Thread Starter Forum Replies Last Post
Newbie Question rhino answers 5 July 1st, 2008 11:35 PM
Blogger template rejects javascript loop Jim answers 6 November 15th, 2007 11:05 AM
How do you use a user control as a template inside a repeater? fernandezr answers 8 July 7th, 2006 03:25 PM
How protect source code in template library? Lokicer answers 2 July 23rd, 2005 02:27 AM
Clarification related to template definition? Karthik D answers 2 July 19th, 2005 08:15 PM