[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

sort with different files

Subject: sort with different files
From: "Markus Hanel" <markus.hanel@xxxxxx>
Date: Thu, 22 Apr 2004 13:16:13 +0200 (MEST)
different files
Hello,
i have a table, where I want to list some students given by there pers_data
in the file students.xml. Therefore I made a file a_format.xml to generate
columns automaticaly which are given as child of the node interviewer. In
the file students.xml the pers_data is destaged with a url.
My problem is now to sort the students by their lastname. The difficult is
that there are different files!
I hope someone can help me.
Many thanks
markus

file a_format.xml
<format>
...
  <interviewer>
    <show>id</show>
    <show>lastname</show>
    <show>surname</show>
    <show>userid</show>
    <show>sex</show>
    <show>birth</show>
    <show>class</show>
  </interviewer>
...
</format>

file students.xml
<root>
...
<node type="interviewee" status="active">
  <pers_data status="active" task="interviewee" id="3">
    <url path="/qpers_data/3.xml" proto="file">
    </url>
  </pers_data>
  <pers_data status="active" task="interviewee" id="4">
    <url path="/qpers_data/4.xml" proto="file">
    </url>
  </pers_data>
</node>
...
</root>

file 3.xml

<pers_data task="interviewee" id="3" status="active">
  <proto>file</proto>
  <type>interviewee</type>
  <surname>name</surname>
  <lastname>name</lastname>
...
</pers_data>

xsl stylesheet:

<table>
  <tr>
<!--generate columns automaticaly which are given in a_format.xml -->
    <xsl:for-each
select="document('/qxml/a_format.xml')/format/interviewer/child::*">
      <xsl:variable name="show_node" select="." />
      <th><xsl:value-of
select="../../style_body/style_display/translation/*[name()=concat('trans_',$show_node)]"
/></th>
    </xsl:for-each>
  </tr>
<!-- list the pers_data of the file students.xml -->
  <xsl:for-each select="$self_node/pers_data[attribute::status='active']">
<!-- sort ???????? -->
  <xsl:sort select="document(./url/@path)/lastname" />
  <xsl:variable name="pers_data_file" select="document(./url/@path)" />
  <xsl:variable name="pos" select="position()" />
      <tr>
        <xsl:for-each
select="document('/qxml/a_format.xml')/format/interviewer/child::*">
        <xsl:variable name="show" select="." />
          <td>
            <xsl:value-of select="$self_node/pers_data[$pos]/*[name()=$show]
| $pers_data_file/pers_data/*[name()=$show]" />
          </td>
        </xsl:for-each>
      </tr>
  </xsl:for-each>
</table>

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.