<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

 <xsl:template match="/">
  <html>
   <head>
    <title>Help!!</title>
   </head>
   <body>
    <xsl:apply-templates/>
   </body>
  </html>
 </xsl:template>

 <xsl:template match="xref">
  <xsl:variable name="xrefid" select="@xrefid"/>
  <a href="#{@target}">

   <xsl:choose>
    <xsl:when test="@xidtype = 'para'">
     <xsl:value-of select="//para0[@id=$xrefid]/title|//subpara1[@id=$xrefid]/title| //subpara2[@id=$xrefid]/title|//subpara3[@id=$xrefid]/title| //subpara4[@id=$xrefid]/title"/>
    </xsl:when>

    <xsl:when test="@xidtype='step'">
     <xsl:value-of select="concat('Step ',  count(../../preceding-sibling::step1) + 1,'.')"/>
    </xsl:when>
   </xsl:choose>
  </a>
 </xsl:template>

 <xsl:template match="step1">
  <p>
   <xsl:variable name="index" select="count(preceding-sibling::step1) + 1"/>
   <a name="step {$index}"></a>
   <xsl:value-of select="concat($index, '. ')"/>
   <xsl:apply-templates/>
  </p>
 </xsl:template>
</xsl:stylesheet><!-- Stylus Studio meta-information - (c) 2004-2006. Progress Software Corporation. All rights reserved.
<metaInformation>
<scenarios ><scenario default="yes" name="Scenario1" userelativepaths="yes" externalpreview="no" url="steps.xml" htmlbaseurl="" outputurl="test.html" processortype="saxon6" useresolver="yes" profilemode="0" profiledepth="" profilelength="" urlprofilexml="" commandline="" additionalpath="" additionalclasspath="" postprocessortype="none" postprocesscommandline="" postprocessadditionalpath="" postprocessgeneratedext="" validateoutput="no" validator="internal" customvalidator=""/></scenarios><MapperMetaTag><MapperInfo srcSchemaPathIsRelative="yes" srcSchemaInterpretAsXML="no" destSchemaPath="" destSchemaRoot="" destSchemaPathIsRelative="yes" destSchemaInterpretAsXML="no"/><MapperBlockPosition></MapperBlockPosition><TemplateContext></TemplateContext><MapperFilter side="source"></MapperFilter></MapperMetaTag>
</metaInformation>
-->