Hi I am usually programming in c++ so XML/XSL/XPATH is not my strong side, but I need to do a transformation and I cannot seem to find a good way of doing it.
We have an xml file that is formatted like this:
<outer>
<element/>
<other_element/>
<message pri="info">
[[!CDATA Error: something is not working]]
</message>
<message pri="info">
[[!CDATA Warning: warnings are boring]]
</message>
</outer>
I need an xsl that can transform this to the exact same xml file, with the exception, that it matches the "Error:" part, and changes the pri attribute to "error".
I need to do this with an xsl transformaton, and I have started looking at XPATH, but I have a hard time finding out how I can accomplish this.
I got as far as matching the messages with a
<xsl:template match="message">
<xsl:choice>
<xsl:when test="tricky part">
</xsl:when>
<xsl:otherwise>
<xsl:justcopythetag>
</xsl:otherwise>
</xsl:choice>
</xsl:template>
I have found out how to copy the other message tags, but I have no clue on how to match the "error" part.
Can anyone help me?