[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] [no subject]<Document> <Legend> <TypeDesc Type="PP" Id="1" PKey="ZZ" xml:lang="EN" ShDes="ZZ" LongDes="ZO Contracts"/> </Legend> </Document> Requirement: To find LongDes Exising XSL file: <xsl:call-template name="getLegend"> <xsl:with-param name="cat" select="'PP'"/> <xsl:with-param name="key" select="'ZZ'"/> </xsl:call-template> <xsl:template name="getLegend"> <xsl:param name="cat"/> <xsl:param name="key"/> <xsl:call-template name="lookup"> <xsl:with-param name="index" select="'legendIndex'"/> <xsl:with-param name="key" select="concat($cat,'_',$key)"/> <xsl:with-param name="doc" select="$legend"/> <xsl:with-param name="expr" select="'@LongDes'"/> </xsl:call-template> </xsl:template> <xsl:template name="lookup"> <!-- index name, i.e. name of the key --> <xsl:param name="index"/> <xsl:param name="key"/> <!-- default value --> <xsl:param name="default" select="''"/> <!-- node in index source document, per default default value --> <xsl:param name="doc" select="$default"/> <!--expr to evaluate to return value, per default result node --> <xsl:param name="expr" select="'.'"/> <!-- force context to document where the lookup table is --> <xsl:for-each select="$doc[1]"> <xsl:variable name="result" select="key($index,$key)"/> <xsl:choose> <xsl:when test="$result"> <xsl:value-of select="xalan:evaluate(concat('$result[1]/',$expr))"/> </xsl:when> <xsl:when test="$default"> <xsl:value-of select="$default"/> </xsl:when> </xsl:choose> </xsl:for-each> </xsl:template>
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|