Mike (archive)
Usenet Archive
- Joined
- Dec 14, 1999
- Messages
- 1,131
- Reaction score
- 0
I am using xsl to transform xml templates to xml. The templates can contain scalar and list 'macros'. If a list is encountered I need to duplicate the subtree and apply one of the list's values (once for each value).
Scalars and lists are represented in xml in-line in the xsl.
It seems like the best approach is to apply-templates to the twig that needs replicating. The problem is that for this to work I need to change the twig's state such that what was a list is now a scalar.
With a bit of code I can create a local copy of the state and tweak the value of the list item to its current scalar value.
Two questions:
1) is there a better approach? (This can't be an original idea, are there any links to other impls?)
2) is there a simpler way to maintain state during node recursion?
Thanks for the help.
--Mike
Scalars and lists are represented in xml in-line in the xsl.
It seems like the best approach is to apply-templates to the twig that needs replicating. The problem is that for this to work I need to change the twig's state such that what was a list is now a scalar.
With a bit of code I can create a local copy of the state and tweak the value of the list item to its current scalar value.
Two questions:
1) is there a better approach? (This can't be an original idea, are there any links to other impls?)
2) is there a simpler way to maintain state during node recursion?
Thanks for the help.
--Mike