Learn XML, XSLT, XPath with Tutorials & Samples


local-name
XML XSL

<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="myFile.xslt"?>

<store>

  <book id="1">
    <title>XML</title>
    <author>Bill</author>
    <price>25.50</price>
  </book>

  <book id="2">
    <title>XSL</title>
    <author>Vijay</author>
    <price>75.60</price>
  </book>

  <book id="3">
    <title>HTML</title>
    <author>Kris</author>
    <price>50.40</price>
  </book>

</store>

<?xml version='1.0'?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  <xsl:output method="html"/>

  <xsl:template match="/">
    <xsl:apply-templates />
  </xsl:template>

  <xsl:template match="*">
    <xsl:value-of select="local-name()"/> = <xsl:value-of select="text()"/><br/>
    <xsl:apply-templates select="*"/>
  </xsl:template>

</xsl:stylesheet>


OutPut:

store =
book =
title = XML
author = Bill
price = 25.50
book =
title = XSL
author = Vijay
price = 75.60
book =
title = HTML
author = Kris
price = 50.40