This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: display in a recursive wayy


> What do we need to add to the program to make these item display in a 
> recursive way? 

This explanation applies to pure XSLT, and you're using MSXML, but I
believe it still applies:

The xsl:value-of instruction makes a text node containing what would
happen if you called the string() function on the XPath expression in the
select attribute. string() on some node-set returns the string-value of
the first node in the set.

So for example, you have multiple 'item' element children of the current
node, when processing the 'detail' element. <xsl:value-of select="item"/>
in that situation will give you the results you are seeing.

You want to iterate through nodes, like:

<xsl:for-each select="item">
  <td><xsl:value-of select="."/></td>
</xsl:for-each>

However you may find that your XML is not very well structured for this
kind of iteration. Right now you have, essentially:

<purchase_order>
  <data/>
  <detail>

    <item/>
    <itemdesc/>
    <amount/>

    <item/>
    <itemdesc/>
    <amount/>

    <!-- ... -->

  </detail>
</purchase_order>

The grouping of item information is difficult to work with when it's like
this. If you put each set of item details in its own containing element,
it would be much easier to iterate through the containers with a for-each.


   - Mike
___________________________________________________________
Mike J. Brown, software engineer, Webb Interactive Services
XML/XSL stuff: http://www.skew.org/    http://www.webb.net/


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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]