I\'m trying to write an XSL that will output a certain subset of fields from the source XML. This subset will be determined at transformation time, by using an external XML
Your stylesheet looks almost fine. Just the expression $rec/$field
doesn't make sense because you can't combine two node sets/sequences this way. Instead, you should compare the names of the elements using the name()
function. If I understood your problem correctly, something like this should work:
...
...
Variable field is not required in this example. You can also use function current()
to access the current context node of the inner loop: