I need to create an XSLT transform to go from
Input
<pizza>
<pref name="cheese_cheddar" value="2" />
<pref name="meat_chicken" value="5" />
<pref name="cheese_edam" value="10" />
</pizza>
to, Output
<pizza>
<pref name="cheese_cheddar" value="2" />
<pref name="tasty_cheese_cheddar" value="2" />
<pref name="meat_chicken" value="5" />
<pref name="cheese_edam" value="10" />
<pref name="tasty_cheese_edam" value="10" />
</pizza>
That is, all elements inside pizza
that start with cheese_
need to be duplicated with the name
element modified to append to word tasty_
.
I've got a matcher working, <xsl:template match="node()[starts-with(@name, 'slippage_')]">
but I've no clue how to duplicate elements and modify an attribute. I've not done XSLT work before so I'm not sure if copy
and copy-to
are appropriate for duplicating elements with different attributes.
No comments:
Post a Comment