Reputation: 1060
I have a huge XML file and I want to do a mass replace in it.
The XML file looks like this:
<xsl:if test="EVN_1_EventTypeCode">
<EVN_1_EventTypeCode>
<xsl:value-of select="EVN_1_EventTypeCode/text()" />
</EVN_1_EventTypeCode>
</xsl:if>
<EVN_2_RecordedDateTime>
<xsl:if test="EVN_2_RecordedDateTime/TS_0_TimeOfAnEvent">
<TS_0_TimeOfAnEvent>
<xsl:value-of select="EVN_2_RecordedDateTime/TS_0_TimeOfAnEvent/text()" />
</TS_0_TimeOfAnEvent>
</xsl:if>
</EVN_2_RecordedDateTime>
<xsl:for-each select="EVN_3_DateTimePlannedEvent">
<EVN_3_DateTimePlannedEvent>
<xsl:if test="TS_0_TimeOfAnEvent">
<TS_0_TimeOfAnEvent>
<xsl:value-of select="TS_0_TimeOfAnEvent/text()" />
</TS_0_TimeOfAnEvent>
</xsl:if>
</EVN_3_DateTimePlannedEvent>
</xsl:for-each>
Now I want to replace every test:
<xsl:if test='bla'>
has to become
<xsl:if test='bla/text()'>
So as you see I want to add "/text" to every test in de xml file.
Can anyone help me?
Upvotes: 0
Views: 1740
Reputation: 3626
Find what: <xsl:if test='(.*)'>
Replace with: <xsl:if test='\1/text'>
Upvotes: 1