XML Development

Moderators: None (Apply to moderate this forum)
Number of threads: 252
Number of posts: 451

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
XSLT nestled for-each problem Posted by trady on 22 Mar 2012 at 3:45 AM
Hi,
I have a problem with a nestled "for-each". I want information from every orditem. Every orderitem have one "orderitem id" and could have several "job id". The sample belove do not work,any suggestions?

XML
<order orderid="20">
  <workflows>
    <workflow id="97"
      <items>
        <orderitem id="1">
          <jobs>
            <job id="150"/>
            <job id="151"/>
          </jobs>
        </orderitem>
      </items>
    </workflow>
    <workflow id="97">
      <items>
        <orderitem id="2">
          <jobs>
            <job id="152"/>
          </jobs>
        </orderitem>
      </items>
    </workflow>
  </workflows>
</order>

XSLT
 <xsl:for-each select="//items/orderitem[@id != '0']">
          <xsl:value-of select="@item-number"/>
	  <xsl:for-each select="/order/jobs/job">
            <xsl:value-of select="@id"/>
          </xsl:for-each>
    </xsl:for-each>


I want the output to be:
1 150 151
2 152

Kind regards / trady




 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.