Hi,
I want to process the following xml:
...
<a>
HHHHeader 1 : xxx <it> yyy </it> zzz
HHHHeader 2 : aaa bbb <it> ccc </it>
</a>
...
And I want to get via a xslt the following xml
...
<a>
<Header hd="1">
xxx <it> yyy </it> zzz
</Header>
<Header hd="2">
aaa bbb <it> ccc </it>
</Header>
</a>
...
Using code like this
<xsl:template match="a">
<xsl:variable name="elValue" select="."/>
<xsl:analyze-string select="$elValue"
regex="HHHHeader ([0-9]*)\s:([\s\S]*)">
<xsl:matching-substring>
<xsl:element name="Header">
<xsl:attribute name="hd" select="regex-group(1)"/>
<xsl:value-of select="regex-group(2)"/>
</xsl:element>
</xsl:matching-substring>
<xsl:non-matching-substring>
<aInError>
<xsl:value-of select="$elValue"/>
</aInError>
</xsl:non-matching-substring>
</xsl:analyze-string>
</xsl:template>
I know how to create the following xml
<a>
<Header hd="1">
xxx yyy zzz
</Header>
<Header hd="2">
aaa bbb ccc
</Header>
</a>
but then the <it> nodes are lost. I have no clue how I could proceed to keep these. Anyone can help ?
Thanx