Using xsl param (if exists) to replcae attribute value
Posted
by Assaf
on Stack Overflow
See other posts from Stack Overflow
or by Assaf
Published on 2010-05-12T10:46:53Z
Indexed on
2010/05/12
10:54 UTC
Read the original article
Hit count: 208
xslt
I would like an xsl that replaces the value attribute of the data elements only if the relevant param
names are passed.
Input
<applicationVariables applicationServer="tomcat">
<data name="HOST" value="localhost"/>
<data name="PORT" value="8080"/>
<data name="SIZE" value="1000"/>
</applicationVariables>
So for example if passing in a param HOST1=myHost and PORT=9080 the output should be:
<applicationVariables applicationServer="tomcat">
<data name="HOST" value="myHost"/>
<data name="PORT" value="9080"/>
<data name="SIZE" value="1000"/>
</applicationVariables>
Note that HOST and PORT where replaced but SIZE was not replaced because there was no parameter with name SIZE
Since the list of data elements is long (and may change), i would like a generic way of doing this with xsl
© Stack Overflow or respective owner