xslt - how to read id's and connect it with name's -


my xml:

<workingtime>     <fromtime>08:00</fromtime>     <totime>11:00</totime>     <name>izpit matematika</name>     <owner>marko lackovic</owner>     <category>         <school professor="111" room="1" subject="882" />     </category> </workingtime>  <professors>     <professor email="xxx" id="111" code="string">name 1</professor>     <professor email="xxx" id="222" code="string">name 2</professor>     <professor email="xxx" id="333" code="string">name 3</professor> </professors> <rooms>     <room id="1">ia-301</room>     <room id="2">a-302</room>     <room id="3">a-303</room>     <room id="4">a-304</room>     <room id="5">a-305</room>     <room id="6">a-306</room>  </rooms> <subjects>     <subject id="881">vaje</subject>     <subject id="882">kolokvij</subject>     <subject id="883">predmet</subject>     <subject id="884">izpit</subject> </subjects> 

how can in xslt print professor, room , subject.

for example:

for professor: name1, room ia-301, , subject kolokvij.

i answer this, please, future, state question little more thought..

assuming workingtime driver/context , assuming xml wrapped "root" tag, write :

<!-- little shortcut variable --> <xsl:variable name="school" select="/root/workingtime/category/school"/>  <xsl:value-of select="concat('for professor: ',                        /root/professors/professor[@id=$school/@professor],                        ', room: ', /root/rooms/room[@id=$school/@room],                        ', , subject: ',                        /root/subjects/subject[@id=$school/@subject])"/>    

karl..


Comments

Popular posts from this blog

java - Run a .jar on Heroku -

java - Jtable duplicate Rows -

validation - How to pass paramaters like unix into windows batch file -