0 votes

I was trying to figure out how to include a header line in a transform. If you could create one from one of the included sample transforms, I'm sure I could add to others.

by (730 points)

1 Answer

0 votes

The text for the headers is not included in the XML output but you can add the header text into the XSLT file. If you take the Sample Transform tab_separate.xsl you can add headers like this:

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
		xmlns:rslt="http://www.mythicsoft.com/FileLocator_16Aug2005"
       version="1.0">

<xsl:output method="text"/>

<xsl:template match="/">

  <!-- Add the header text -->

  <xsl:text>Path</xsl:text>
  <xsl:text>&#09;</xsl:text>
  <xsl:text>Name</xsl:text>
  <xsl:text>&#09;</xsl:text>
  <xsl:text>Size</xsl:text>
  <xsl:text>&#09;</xsl:text>
  <xsl:text>File Type</xsl:text>
  <xsl:text>&#09;</xsl:text>
  <xsl:text>Modified</xsl:text>
  <xsl:text>&#09;</xsl:text>
  <xsl:text>Last Access</xsl:text>
  <xsl:text>&#09;</xsl:text>
  <xsl:text>Created</xsl:text>
  <xsl:text>&#09;</xsl:text>
  <xsl:text>Hit Count</xsl:text>
  <xsl:text>&#09;</xsl:text>
  <xsl:text>&#13;&#10;</xsl:text>

  <!-- Process the file data -->

  <xsl:apply-templates select="//rslt:file"/>
</xsl:template>

<xsl:template match="rslt:file">
  <xsl:value-of select="rslt:path"/>
  <xsl:text>&#09;</xsl:text>
  <xsl:value-of select="rslt:name"/>
  <xsl:text>&#09;</xsl:text>
  <xsl:value-of select="rslt:size"/>
  <xsl:text>&#09;</xsl:text>
  <xsl:value-of select="rslt:type"/>
  <xsl:text>&#09;</xsl:text>
  <xsl:value-of select="rslt:modified"/>
  <xsl:text>&#09;</xsl:text>
  <xsl:value-of select="rslt:lastaccess"/>
  <xsl:text>&#09;</xsl:text>
  <xsl:value-of select="rslt:created"/>
  <xsl:text>&#09;</xsl:text>
  <xsl:value-of select="rslt:contents/@rslt:totalhitcount"/>
  <xsl:text>&#09;</xsl:text>
  <xsl:text>&#13;&#10;</xsl:text>
</xsl:template>

</xsl:stylesheet>

by (30.1k points)
...