Re: [xsl] what's the best way to do this

Subject: Re: [xsl] what's the best way to do this
From: Matthieu Ricaud-Dussarget <matthieu.ricaud@xxxxxxxxx>
Date: Thu, 05 Jan 2012 12:00:12 +0100
Hi Roelof,

This time, I'm not late !

I don't see any difficulty to get the HTML ouput, it's just in the same order than the XML. I would actually
- match the root "menu" element to make the html, head and body elements,
- then match "section" to make the "div id=firstpane" (be carefull with id unicity if the xml contains many sections) and his skeleton i.e "menu_head" and "menu_body"
- then match "year" to fullfill menu_head
- then "month" to construct the links
- and ignoring entry



But maybe the problem is about converting numerical month values to litterals ones ?


To do this, you have to write somewhere the correspondance "numeric - litteral".

You have 2 options :
- either in an external xml file (i think this kind of file is call "authority list")
=> then reading the file from your XSL (using document() function, or aggregate it before with xproc/cocoon... many solutions here)
- or within your XSLT :
- with a test (choose/when/otherwise..) but this is not handy to maintain
- with variable
- type nodeset if XSLT1
- containing a sequence (XSLT2)


Hope this help,

Matthieu



Le 05/01/2012 11:33, Roelof Wobben a C)crit :

Hello,




Last question and then I have the site ready.



I have now this xml :



<menu>

<section id="9" handle="dagboek">Dagboek</section>

<year value="2005">

<month value="03">

<entry id="17" />

</month>

<month value="02">

<entry id="16" />

<entry id="15" />

<entry id="14" />

</month>

</year>

</menu>



And I like to have this output :



<div id="firstpane" class="menu_list">

<p class="menu_head">2005</p>

<div class="menu_body">

<a href="#">februari</a>

<a href="#">maart</a>

</div>

</div>



And I wonder now what's the best approach to get all the months under the year ?



Regards,



Roelof




--
Matthieu Ricaud
05 45 37 08 90
NeoLibris

Current Thread