xsl-list
[Top] [All Lists]

RE: sort with different files

2004-04-22 04:18:03
you can do a sort using the document function if thats what you mean

-----Original Message-----
From: Markus Hanel [mailto:markus(_dot_)hanel(_at_)gmx(_dot_)at]
Sent: 22 April 2004 12:16
To: xsl mailinglist
Subject: [xsl] sort with 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>


--+------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--+--


<Prev in Thread] Current Thread [Next in Thread>