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 March 4th, 2009, 12:50 PM
Authorized User
 
Join Date: Feb 2009
Posts: 43
Thanks: 10
Thanked 0 Times in 0 Posts
Default Problem with xsl:value in nested xsl:for each

My xml is a s follows...

Code:
<careers  dcr="/xxxx/Careers/data/ij-NewYorkHeadTesting">
     <location>New York</location> 

    <jobtitle>New York Head Of Testing</jobtitle> 

    <departmentoverview>AAAAAAA010AAAAAAA020AAAAAAA030AAAAAAA040AAAAAAA050AAAAAAA060AAAAAAA070AAAAAAA080AAAAAAA090AAAAAAA100AAAAAAA110AAAAAAA120AAAAAAA130AAAAAAA140AAAAAAA150AAAAAAA160AAAAAAA170AAAAAAA180AAAAAAA190AAAAAAA200AAAAAAA210AAAAAAA220AAAAAAA230AAAAAAA240AAAAAAA250AAAAAAA260AAAAAAA270AAAAAAA280AAAAAAA290AAAAAAA300AAAAAAA310AAAAAAA320AAAAAAA330AAAAAAA340AAAAAAA350AAAAAAA360AAAAAAA370AAAAAAA380AAAAAAA390AAAAAAA400AAAAAAA410AAAAAAA420AAAAAAA430AAAAAAA440AAAAAAA450AAAAAAA460AAAAAAA470AAAAAAA480AAAAAAA490AAAAAAA500</departmentoverview> 

    <positionsummary>AAAAAAA010AAAAAAA020AAAAAAA030AAAAAAA040AAAAAAA050AAAAAAA060AAAAAAA070AAAAAAA080AAAAAAA090AAAAAAA100AAAAAAA110AAAAAAA120AAAAAAA130AAAAAAA140AAAAAAA150AAAAAAA160AAAAAAA170AAAAAAA180AAAAAAA190AAAAAAA200AAAAAAA210AAAAAAA220AAAAAAA230AAAAAAA240AAAAAAA250AAAAAAA260AAAAAAA270AAAAAAA280AAAAAAA290AAAAAAA300AAAAAAA310AAAAAAA320AAAAAAA330AAAAAAA340AAAAAAA350AAAAAAA360AAAAAAA370AAAAAAA380AAAAAAA390AAAAAAA400AAAAAAA410AAAAAAA420AAAAAAA430AAAAAAA440AAAAAAA450AAAAAAA460AAAAAAA470AAAAAAA480AAAAAAA490AAAAAAA500</positionsummary> 

  - <businesscompetencies>
   - <dutiesandresponsibililites>
     <bulletpt>AAAAAAA010AAAAAAA020AAAAAAA030AAAAAAA040AAAAAAA050</bulletpt>  

   </dutiesandresponsibililites>


  - <educationandexperience>
     <bulletpt>AAAAAAA010AAAAAAA020AAAAAAA030AAAAAAA040AAAAAAA050</bulletpt>  

   </educationandexperience>


  - <commercialawareness>
     <bulletpt>AAAAAAA010AAAAAAA020AAAAAAA030AAAAAAA040AAAAAAA050</bulletpt>  

   </commercialawareness>


  - <managementrequirements>
     <bulletpt>AAAAAAA010AAAAAAA020AAAAAAA030AAAAAAA040AAAAAAA050</bulletpt>  

   </managementrequirements>


   </businesscompetencies>


  - <personalcompetencies>
   - <personalimpact>
     <bulletpt>AAAAAAA010AAAAAAA020AAAAAAA030AAAAAAA040AAAAAAA050</bulletpt>  

   </personalimpact>


  - <communication>
     <bulletpt>AAAAAAA010AAAAAAA020AAAAAAA030AAAAAAA040AAAAAAA050</bulletpt>  

   </communication>


  - <teamwork>
     <bulletpt>AAAAAAA010AAAAAAA020AAAAAAA030AAAAAAA040AAAAAAA050</bulletpt>  

   </teamwork>


   </personalcompetencies>


    <active>Yes</active> 

   </careers>


I am using the following xsl to display career titles (sorted) by location which

Code:
<xsl:for-each select="$dcr[generate-id() = generate-id(key('by-location', location)[1])]">
             <xsl:sort select="location"/>
              <tr valign="top">
           <td valign="top">
                      <xsl:if test="active  = 'Yes'">
                        <b><a name="{location}"><xsl:value-of select="location"/></a></b><br/>
                        <xsl:for-each select="key('by-location',location)/jobtitle">
                          <xsl:sort select="."/> 
                          <a href="$PAGE_LINK[information/about/Careers/careers-detail]dcr={$dcr/@dcr}"><xsl:value-of select="."/></a><br/>
                        </xsl:for-each>   
                      </xsl:if>
                </td>
         </tr>
             </xsl:for-each>

Essentially my problem, is that now that I have the nested for each, which works for the sorting of the job titles within the location, the @dcr only picks up the 1st dcr.


What do I have to do/add to make

Code:
<a href="$PAGE_LINK[information/about/Careers/careers-detail]dcr={@dcr}"><xsl:value-of select="jobtitle"/></a><br/>

work within the 2nd <xsl:for each />. It works within the first <xsl:for-each/>, but that is not what I need.
 
Old March 4th, 2009, 01:04 PM
Friend of Wrox
 
Join Date: Nov 2007
Posts: 1,243
Thanks: 0
Thanked 245 Times in 244 Posts
Default

See answer in Trying to sort within a sorted list.
__________________
Martin Honnen
Microsoft MVP (XML, Data Platform Development) 2005/04 - 2013/03
My blog
The Following User Says Thank You to Martin Honnen For This Useful Post:
rabs (March 4th, 2009)





Similar Threads
Thread Thread Starter Forum Replies Last Post
How to get the value of last 3 nested nodes using xsl:for-each rabs XSLT 3 February 26th, 2009 10:17 AM
How to get the value of first 3 nested nodes using xsl:for-each eruditionist XSLT 5 February 25th, 2009 04:18 PM
XSL multiple files in table (nested for-each ?) pedoublety XSLT 5 August 21st, 2007 08:00 AM
Pass link values as xsl:parameter to php5 then xsl pauljr8 XSLT 1 July 2nd, 2007 10:32 PM
XSL Transform with xsl string NOT xsl file skin XSLT 0 June 16th, 2003 07:30 AM





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