Forum Moderators: open

Message Too Old, No Replies

XSL & XML

XSL or scripting?

         

Hugene

1:31 am on Oct 4, 2005 (gmt 0)

10+ Year Member



Sorry to ask such a basic question but it has to be done

My c++ program spits out a pretty large and entangled xml document, that has nested xml tags, repeated xml tags etc. Look something like

<cat name=”mother” size=”” more=”” …>
<cat name=”kid1” size=”” more=”” …>
</cat>
<cat name=”kid2” size=”” more=”” …>
</cat>
</cat>
<dog>some info</dog>
<dog>some more info</dog>
<cat name=“ “ type=”age”>23</cat>
<cat name=“ “ type=”age”>25</cat>

I tried to format this with XSL, but it seems like XSL takes the info sequentially and applies the template (at least that’s all I can do for now).

Basically I am just asking if it is possible, just by using XSL, to place attributes at whichever location I want in an html file? Ex:

1st cat <b><xsl:cat nam></b> <i><xsl cat: age></i>
2nd cat <b><xsl:cat nam></b> <i><xsl cat: age></i>
Only now the dogs
<b><xsl:cat nam></b> <i><xsl cat: age></i>
<b><xsl:cat nam></b> <i><xsl cat: age></i>
Now back to the cats
1st cat <b><xsl:cat nam></b> <i><xsl cat: size></i>
2nd cat <b><xsl:cat nam></b> <i><xsl cat: size></i>

I want to treat the info in the tags and between tags as variables that I can place anywhere, without a specific order in the html. Can XSL do this, or should I forget it and go to PHP, Perl or others?

Thanks a lot