It pays to be honest, so I'll be up-front about this. The question arises from
an assignment on a course I'm doing.
However, I don't want to cheat, so I'll try to form the question in the most
general way that I can:
The purpose of the exercise is to convert some xml to html. I have a repeating
element under the root - let's call it anElement. Initially, the requirement
was to output all its contents, unchanged. So I could do this:
<xsl:for-each select="anElement">
<xsl:value-of select="." />
</xsl:for-each>
The anElement element has mixed content and would be described in a DTD as
follows:
<!ELEMENT anElement (#PCDATA | tag1 | tag2 | tag3 | tag4)* >
All the child tags contain #PCDATA only.
The new requirement is to print all the content as before, but to print the
contents of tag2 (say) in italics - i.e. surround its contents with <i></i>
html tags.
I've sweated over this all weekend and can't work out how to solve it. If I
treat each tag individually in a for-each or an apply-templates/template
combination (if that makes sense), I can't see how to output the #PCDATA in
anElement.
Any help would be appreciated - especially a pointer to a resource that will
let me work it out for myself. I've tried the obvious places like w3c schools.
Thank for your attention
Peter