XML
-----
XSL
-----
I want to display in this order
ERM CASE ID
ACCOUNT NUMBER
ERM CASE CATEGORY
but my display comes in the order of source xml file
ACCOUNT NUMBER
ERM CASE CATEGORY
ERM CASE ID
-----
Code:
<vdu vdu_id="4b8febcd000000000a5901f2232f0002"> <field><name>vdu_id</name><value>4b8febcd000000000a5901f2232f0002</value></field> <Field><Name>ANI</Name><Value></Value> </Field> <Field><Name>AccountNumber</Name><Value></Value> </Field> <Field><Name>ERMCaseCategory</Name><Value></Value> </Field> <Field><Name>ERMCaseId</Name><Value></Value> </Field> <Field><Name>extradata</Name><Value></Value> <Container count="6"> <Field><Name>emailtype</Name><Value>NOR</Value> </Field> <Field><Name>messageId</Name><Value>589</Value> </Field> <Field><Name>tenantLogoURL</Name><Value></Value> </Field> <Field><Name>tenant_key</Name><Value>2</Value> </Field> <Field><Name>tenantname</Name><Value>IMLGTenant</Value> </Field> <Field><Name>trackingNumber</Name><Value>T201003040002</Value> </Field> </Container> </Field> </vdu>
-----
Code:
<HTML> <HEAD> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/> <TITLE>eDU Viewer</TITLE> </HEAD> <BODY STYLE="border: 0px; margin: 0px; font-family: arial; font-style: bold;font-size: 10pt"> <xsl:for-each select="vdu"> <TABLE BORDER="1" CELLSPACING="1" CELLPADDING="1" STYLE="border:0px; margin: 0px; font-family: arial; font-style: bold;font-size: 8pt"> <xsl:for-each select="Field[not(Container or IndexedContainer)]"> <xsl:apply-templates/> </xsl:for-each> <xsl:for-each select="Field[Container or IndexedContainer]"> <xsl:choose> <xsl:when test="Name[. = 'customerInfo']"> <TR><TD bgcolor="yellow" align="center" colspan = "2"><B>Customer Information</B></TD></TR> <xsl:apply-templates/> </xsl:when> <!-- Put list of top level containers that should be displayed --> <!-- nested containers require additional customization --> <xsl:when test="yellow[. = 'xxContainerNamexx']"> <TR><TD bgcolor="red" align="center" colspan="2"><B>xx Container Name xx</B></TD></TR> <xsl:apply-templates/> </xsl:when> </xsl:choose> </xsl:for-each> </TABLE> </xsl:for-each> </BODY> </HTML> </xsl:template> <xsl:template match="Field[not(Container or IndexedContainer)]/Name"> <xsl:apply-templates select="Field/Name[. = 'ERMCaseId']"/> <xsl:apply-templates select="Field/Name[. = 'AccountNumber']"/> <xsl:apply-templates select="Field/Name[. = 'ERMCaseCategory']"/> </xsl:template> <xsl:template match="Field/Name[. = 'ERMCaseId']"> <xsl:if test="../Name[. = 'ERMCaseId']"><TR><TD><TH ALIGN="left">ERM CASE ID</TH></TD><TD><xsl:value-of select="../Value"/></TD></TR></xsl:if> </xsl:template> <xsl:template match="Field/Name[. = 'AccountNumber']"> <xsl:if test="../Name[. = 'AccountNumber']"><TR><TD><TH ALIGN="left">ACCOUNT NUMBER</TH></TD><TD><xsl:value-of select="../Value"/></TD></TR></xsl:if> </xsl:template> <xsl:template match="Field/Name[. = 'ERMCaseCategory']"> <xsl:if test="../Name[. = 'ERMCaseCategory']"><TR><TD><TH ALIGN="left">ERM CASE CATEGORY</TH></TD><TD><xsl:value-of select="../Value"/></TD></TR></xsl:if> </xsl:template>
I want to display in this order
ERM CASE ID
ACCOUNT NUMBER
ERM CASE CATEGORY
but my display comes in the order of source xml file
ACCOUNT NUMBER
ERM CASE CATEGORY
ERM CASE ID
Comment