I have an XML file which has many section like the one below:
<Operations>
<Action [some attributes ...]>
[some complex content ...]
</Action>
<Action [some attributes ...]>
[some complex content ...]
</Action>
</Operations>
I have to add an <Action/>
to every <Operations/>
. It seems that an XSLT should be a good solution to this problem:
<xsl:template match="Operations/Action[last()]">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
<Action>[some complex content ...]</Action>
</xsl:template>
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
My problem is that the content of my <Action/>
contains some xPath expressions. For example:
<Action code="p_histo01">
<customScript languageCode="gel">
<gel:script
xmlns:core="jelly:core"
xmlns:gel="jelly:com.niku.union.gel.GELTagLibrary"
xmlns:soap="jelly:com.niku.union.gel.SOAPTagLibrary"
xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:sql="jelly:sql"
xmlns:x="jelly:xml"
xmlns:xog="http://www.niku.com/xog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<sql:param value="${gel_stepInstanceId}"/>
</gel:script>
</customScript>
</Action>
The ${gel_stepInstanceId}
is interpreted by my XSLT but I would like it to be copied as-is. Is that possible? How?