How to add some complexe structure in multiple places in an XML file
- by Guillaume
I have an XML file which has many section like the one below :
<Operations>
<Action [some attibutes ...]>
[some complexe content ...]
</Action>
<Action [some attibutes ...]>
[some complexe content ...]
</Action>
</Operations>
I have to add an to every . 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 complexe 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 contains some xPath expressions. For exemple :
<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 posible ? How ?