Subject: RE: sort with different files
From: "Markus Hanel" <markus.hanel@xxxxxx>
Date: Thu, 22 Apr 2004 13:26:34 +0200 (MEST)
|
I have tried it with the document, but the problem is that i work with the
file students.xml where the pers_data nodes included. But the pers_datas are
destaged with a url. Which document must I select by the xsl element sort?
> you can do a sort using the document function if thats what you mean
>
> -----Original Message-----
> From: Markus Hanel [mailto:markus.hanel@xxxxxx]
> Sent: 22 April 2004 12:16
> To: xsl mailinglist
> Subject: 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>
|