Changing One Tag Name in an XML File Using XSLT
Posted
by AlbertoPL
on Stack Overflow
See other posts from Stack Overflow
or by AlbertoPL
Published on 2010-04-04T02:55:15Z
Indexed on
2010/04/04
3:03 UTC
Read the original article
Hit count: 540
Is it possible for me to have a conditional in XSLT such that I find and replace only the FIRST tag of a particular tag name?
For example, I have an XML file with many tags. I would like to replace the first of these tags with . The rest should be left alone. How would I do this in my transform? What I currently have is this:
<xsl:template match="title">
<PageTitle>
<xsl:apply-templates />
</PageTitle>
</xsl:template>
which finds all tags and replaces them with PageTitle. Any help would be greatly appreciated!
© Stack Overflow or respective owner