I\'m having a slight problem with my XSLT transform.
I have the following XSLT;
-
There are a number of issues with your XSLT. Focusing on the problem in hand, one issue is in one of your "order" templates uses an xsl:copy-of
Before going further though, you have two templates matching "order". This is strictly speaking specified as an error in XSLT. You may not actually be seeing an error because some processors ignore the duplicate templates, and only use the last one. You should delete the first one.
Anyway, by using xsl:copy-of
it is simply going to copy all master_version
elements here, regardless of any other template matches here. You need to use xsl:apply-templates
But this on its own will not work because of these two template matches (although it is an error to have to templates both matching just master_version
as mentioned)
Remove the master_version
from these template matches, and leave just this existing one
(Note that when an element is matched with a condition, it will actually have a higher priority than one that just matched master_version
, so this is not an error in this instance).
You would also be there at this point, but you would find now that master_version
would still be output in their current place too. To get around this, you can have a template matching dataroot
and add code to explicitly ignore the master_version
elements at that point
Try this XSLT. It may not give the precise output you specified, but it should solve the problem on your master_version
elements which you asked about:
Also note the multiple identity templates have been removed, as mentioned by Daniel Haley in comments.
讨论(0)
- 热议问题