multiple XSL transforms in one? OR a generate-id() problem.

W

Wizfrog

Hello,

I'm working on a fairly complex project where it seems easier to
transform XML data into some other XML tree like structure, before
using that tree to build my HTML display.

so, instead of using 2 XSL transforms, is there a way to do it all at
once, doing 2 passes?


basically my problem is that I have a linear set of data, where each
element may be a sub element of another or many others.

the display to the user is a form of hierarchy tree, so i generate the
tree first from the linear structure, but I want unique ID for each
element of the tree, however when i use the generate-id() function, i
get multiple object with the same id, since the is the same element in
the original document, so I end up needing to do a second pass to
generate ids from the elements of the tree structure which are unique.

My tree is pretty big already (several 100's elements) so it is pretty
slow to generate one pass. Ideally i'd like to speed this up too :)

any insight?

let me know!
 
M

Martin Honnen

Wizfrog said:
I'm working on a fairly complex project where it seems easier to
transform XML data into some other XML tree like structure, before
using that tree to build my HTML display.

so, instead of using 2 XSL transforms, is there a way to do it all at
once, doing 2 passes?

Using XSLT 2.0 it is possible with standard XSLT 2.0, with XSLT 1.0 you
will need to use an extension function to convert your XML result tree
fragment of the first pass into a node set that you then transform with
the second pass into HTML. Many processors support exsl:node-set
(<http://exslt.org/exsl/functions/node-set/index.html>) or similar but
not all.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top