[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

order on lookup values.

Subject: order on lookup values.
From: Khalid Ansari <KhalidAn@xxxxxxxxx>
Date: Wed, 19 Sep 2007 09:35:39 -0700 (PDT)
 order on lookup values.
I have a lookup xml which contains both description and filed names for each
error code in my source xml.

<Codes>

    <Code>
<ErrorCodes>Erro1</ErrorCodes>

        <Description>Invalid action
indicator</Description>

        <Field>actionIndicator</Field>

    </Code>
<Code>

        <ErrorCodes>Error2</ErrorCodes>

        <Description>Invalid
User</Description>

        <Field>userName</Field>

    </Code>



....
</Codes>



I process following xml with XSL to combine errorcodes,
descriptions and fieldnames.





  <ErrorGroup>

   <row>

    <SystemError>
<ErrorCode>Error1</ErrorCode>

    </SystemError>

   </row>

   <row>
<SystemError>

     <ErrorCode>Error2</ErrorCode>

    </SystemError>
</row>

   <row>

    <SystemError>

     <ErrorCode>Error3</ErrorCode>
</SystemError>

   </row>

  </ErrorGroup>





and following is my xsl
<xsl:key name="code-lookup" match="Code" use="ErrorCodes"/>

    <xsl:variable
name="codes-top" select="document("codes.xml")/Codes"/>
<xsl:template match="SystemError">

       <xsl:text> Error : </xsl:text>
<xsl:value-of select="ErrorCode"/>

               <xsl:text> means
</xsl:text>

                    <xsl:apply-templates select="$codes-top">
<xsl:with-param name="curr-errorcode" select="ErrorCode"/>
</xsl:apply-templates>

    </xsl:template>

    

    

    <xsl:template
match="Codes">

        <xsl:param name="curr-errorcode"/>
<xsl:variable name="tempError" select="normalize-space($curr-errorcode)"/>
<xsl:variable name="tempMsg" select="key('code-lookup',
$tempError)/Description"/>

        <xsl:variable name="fieldName"
select="key('code-lookup', $tempError)/Field"/>
<xsl:value-of select="$tempMsg"/> 



       <xsl:text> : Field Name :
</xsl:text><xsl:value-of select="$fieldName"/>

</xsl:template>



Currently I
am getting outputs like:



Error: Error1 means Invalid action indicator :
Field Name : actionIndicator

Error: Error2 means Invalid user : Field Name :
userName



But I need to get output as following.
................................................

Error: Error1 means Invalid
action indicator 

Error: Error2 means Invalid user



Field Names:
actionIndicator

userName

I tried different approaches but none worked for
me.  Can someone help me please.
Thanks,
Khalid Ansari
_____________________________________________________________________________
_______
Catch up on fall's hot new shows on Yahoo! TV. Watch previews, get
listings, and more!
http://tv.yahoo.com/collections/3658

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.