Subject: [xsl] sort to categories From: "Markus Hanel" <markus.hanel@xxxxxx> Date: Thu, 16 Dec 2004 09:56:39 +0100 (MET) |
hello, can anyone give my an idea to solve the following problem: I want to sort some students to the categories: division and group; but the categories should be flexible and expandable; at an other time for example school, division and group; they should be given in a separat xml file; the output should be in the following way: division1 group1 hauser monika wilhelm arno group2 maier martin division2 group1 jonak gert walch stefan ... I have managed it with one fixed category, but now i have no ideas! many thanks, markus xml file <node label="interviewees" status="active" type="interviewee"> <pers_data id="2" status="active" task="interviewee"> <url path="/quirxi/qpers_data/2.xml" proto="file"/> </pers_data> <pers_data id="3" status="active" task="interviewee"> <url path="/quirxi/qpers_data/3.xml" proto="file"/> </pers_data> <pers_data id="4" status="active" task="interviewee"> <url path="/quirxi/qpers_data/4.xml" proto="file"/> </pers_data> ... </node> the pers_data files look like <pers_data task="interviewee" id="4" status="active"> <surname>Martin</surname> <lastname>Maierunteregger</lastname> <group>group1</group> <division>Innenausbau</division> <school>htl imst</school> <userid>c</userid> <pass>c</pass> <sex>m</sex> </pers_data> stylesheet <?xml version="1.0"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:variable name="mod_admin" select="document('../qxml/a_format_default.xml')/format/modul[attribute::label = 'interviewer']/files/file[attribute::name = 'qier_group_take_iees']" /> <xsl:template match="/"> <html> <head><title></title> </head> <body> <xsl:apply-templates select="./node[attribute::type='interviewee']/pers_data[attribute::status = 'active']" /> </body> </html> </xsl:template> <xsl:template match="pers_data"> <xsl:variable name="take_category" select="$mod_admin/param[attribute::label = 'body']/shows/show[position() = last()]" /> <xsl:variable name="select_category" select="document(./url/@path)/pers_data/*[name()=$take_category]" /> <xsl:if test="not(following-sibling::pers_data[document(./url/@path)/pers_data/*[name()=$take_category] = $select_category)"> <xsl:apply-templates select="../descendant::pers_data[document(./url/@path)/pers_data/group = $select_category]" mode="take"> <xsl:sort select="document(./url/@path)/pers_data/lastname" /> <xsl:sort select="document(./url/@path)/pers_data/surname" /> </xsl:apply-templates> </xsl:if> </xsl:choose> </xsl:template> <xsl:template match="pers_data" mode="take"> <div>       <xsl:value-of select="document(./url/@path)/pers_data/lastname" /> </div> </xsl:template> </xsl:stylesheet>
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: [xsl] no attributes outputed wh, Geert Josten | Thread | RE: [xsl] sort to categories, Michael Kay |
Re: [xsl] Tree from directory listi, Mukul Gandhi | Date | RE: [xsl] no attributes outputed wh, Michael Kay |
Month |