I have an xml document (input file cannot be changed) which I need to transform with xsl to another xml. The input xsl have a CDATA as shown in following example structure:
<TestCaseElement>
<Role>VP</Role>
<Code>
<Line>
<![CDATA[<id>l1_SomeId1</id> <val1>l1_SomeVal1</val1> <val2>l1_SomeVal2</val2> <algo>l1_somealgo</algo>]]>
</Line>
<Line>
<![CDATA[<id>l2_someid1</id> <val1>l2_SomeVal1<val1> <val2>l2_SomeVal2<val2> <algo>l2_somealgo</algo>]]>
</Line>
</Code>
<TestCaseElement>
The expected result is something like:
<Expected>
<MEASV id="l1_SomeId1" val1="l1_SomeVal1" val2="l1_SomeVal2" algo="l1_somealgo">
<MEASV id="l2_SomeId1" val1="l2_SomeVal1" val2="l2_SomeVal2" algo="l2_somealgo">
</Expected>
My Xslt looks like:
<Expected>
<xsl:for-each select="TestCaseElement[(Role='VP')]/Code/Line">
<xsl:for-each select="current()/*">
<MEASV>
<xsl:attribute name="{fn:local-name()}"><xsl:value-of select="current()"/></xsl:attribute>
</MEASV>
</xsl:for-each>
</xsl:for-each>
</Expected>
The problem is the xslt doesn't recognize the tags inside CDATA. How can I apply a sort of disable-output-escaping for for-each? Or any other method to solve this?