0

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?

1 Answer 1

1

Find what: <xsl:if test='(.*)'> Replace with: <xsl:if test='\1/text'>

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.