|
next
|
 Subject: How to set output order? Author: Gary Daniels Date: 14 Apr 2006 08:33 PM
|
Hi. Newbie here looking for some help. I need to have my output always in the same order. The XSL Stylesheet that follows, parses data from a "Multi-page" XML document. Each "Page" or node has an "@id" (W1S, W2S, W4S, W7S, WSA). Most of the documents that are parsed have nodes in this order, however, some have "page" or node W4S following "page" or node W7S, instead of node W2S. This causes a different sequence of elements, which, in turn, results in the output having a similarly different sequence. How would I be able to modify the XSL Stylesheet to "force" the output to always appear in the same sequence, regardless of the sequence of the elements in the XML document being parsed? Thanks in advance for your assistance.
Gary
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="text"/>
<xsl:template match="AppraisalForm">
<!-- Select specific Node or Form based on its id --><xsl:if test="@id='W1S'">
File #<xsl:value-of select="field[@id='4']/value"/>|
Address <xsl:value-of select="field[@id='1001']/value"/>|
City <xsl:value-of select="field[@id='1002']/value"/>|
</xsl:if>
<!-- Select a different specific Node or form based on its id --><xsl:if test="@id='W2S'">
Water <xsl:value-of select="field[@id='14116']/value"/>|
Sewer <xsl:value-of select="field[@id='14126']/value"/>|
Heat <xsl:value-of select="field[@id='14127']/value"/>|
</xsl:if>
<!-- Select a different specific Node or form based on its id --> <xsl:if test="@id='W4S'">
OAR SP <xsl:value-of select="field[@id='60293']/value"/>|
GIM SP <xsl:value-of select="field[@id='60291']/value"/>|
Sale Date <xsl:value-of select="field[@id='60016']/value"/>|</xsl:if>
<!-- Select a different specific Node or form based on its id --><xsl:if test="@id='W5S'">
Vac Percent <xsl:value-of select="field[@id='80090']/value"/>|</xsl:if>
<!-- Select a different specific Node or form based on its id --><xsl:if test="@id='W7S'">
Year <xsl:value-of select="field[@id='150955']/value"/>|
Source <xsl:value-of select="field[@id='152539']/value"/>|
Rental Inc <xsl:value-of select="field[@id='150982']/value"/>|
Laundry <xsl:value-of select="field[@id='150984']/value"/>|
</xsl:if>
<!-- Select a different specific Node or form based on its id --><xsl:if test="@id='WSA'">
OAR Val <xsl:value-of select="field[@id='97015']/value"/>|
GIM Val <xsl:value-of select="field[@id='97000']/value"/>|
Value <xsl:value-of select="field[@id='150615']/value"/>|
</xsl:if>
</xsl:template></xsl:stylesheet>
|
|
|