xml editor

Supported platforms

Compatible with Windows7 & Mac OS X Snow Leopard

Ready for data server software
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] multiple child elements


Subject: Re: [xsl] multiple child elements
From: Jeni Tennison <mail@xxxxxxxxxxxxxxxx>
Date: Sun, 9 Sep 2001 11:57:18 +0100

Hi Sean,

> how do i display all the child elements from the XML file without
> having to give each child a unique tag name?

I assume that you want to generate something like:

  <a href="http://www.korg.com">korg.com</a>
  <a href="http://www.lfo4.com">lfo4.com</a>

In other words, for each url element in your source document, you want
to generate an a element whose href attribute is equal to the value of
the url element and whose value is equal to the name attribute of the
url element.

Note that you want to generate an a element for each *url* element,
so the xsl:for-each that you use should select the url elements, as
follows:

  <xsl:for-each select="kitlist/synth/links/url">
    ...
  </xsl:for-each>

As you had it, it selected the synth element, of which there is only
one in your document, so you only got one a element.
  
You can then generate the a elements for each of them similarly to the
code that you demonstrated, but with the paths being relative to the
url element rather than relative to the synth element; also I'd use an
attribute value template rather than xsl:attribute, as follows:

  <xsl:for-each select="kitlist/synth/links/url">
    <a target="_blank" href="{.}">
      <xsl:value-of select="@name" />
    </a>
  </xsl:for-each>

I hope that helps,

Jeni

---
Jeni Tennison
http://www.jenitennison.com/


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



Current Thread
Keywords
xml
XML Editor | XML Author | WYSIWYG Editors | Schema Editor | XSD Documentation | XSL/XSLT Editor | XQuery | XML Databases | SVN Client
© 2002-2011 SyncRO Soft Ltd. All rights reserved. | Sitemap | Privacy Policy | This website was created & generated with <oXygen/>®XML Editor