Mega Code Archive

 
Categories / XML Tutorial / Xpath
 

Match element by name

File: Data.xml <?xml version="1.0" encoding="UTF-8"?> <SeasonStats>   <Player id="p0001">     <Name>Jordon</Name>   </Player> </SeasonStats> File: Transform.xslt <?xml version="1.0" encoding="iso-8859-1" ?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"   version="1.0">   <xsl:output method="text" />   <xsl:template match="/">     <xsl:apply-templates />   </xsl:template>   <xsl:template match="Player">     <xsl:apply-templates select="Name" />   </xsl:template>   <xsl:template match="Name">     <xsl:value-of select="." />   </xsl:template> </xsl:stylesheet> Output:   Jordon