Linki

w3 spec: xslt1.0 xpath1.0

Snippety

  1. node path
        <xsl:for-each select="ancestor-or-self::*">
          <xsl:value-of select="concat('/', name(.))" />
        </xsl:for-each>
  2. whole file
    <?xml version="1.0" encoding="UTF-8"?>
    <xsl:stylesheet
      xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
      xmlns:xsd="http://www.w3.org/2001/XMLSchema"
      xmlns:excel="urn:schemas-microsoft-com:office:spreadsheet"
      version="1.0"
      >
      <xsl:output method="text"
                  omit-xml-declaration="no"
                  encoding="UTF-8"
      />
    >

      <xsl:template match="*" >
        <xsl:apply-templates select="@*|node()" />
        <xsl:value-of select="name(.)" />
        <xsl:value-of select="'&#xa;'" />
      </xsl:template>

    <!-- don't output text nodes (override default behavior) -->
      <xsl:template match="@*|text()|processing-instruction()" />

      <xsl:template match="/"  >
        <xsl:copy>
          <xsl:apply-templates select="@*|node()" />
        </xsl:copy>
      </xsl:template>

    </xsl:stylesheet>