XML : select the value of an xml attribute of an element if value of another attribute matches with value stored in a variable using xslt

I have below sample configuration. I have an xsl in which I have space seperated scope(getAccoutInfo getCustomerInfo) stored in variable 'scope', what you see below inside scope element as an individual input attribute. I am tokenizing them using str:tokenize

  <scopes>       <scope input="getAccountInfo" output="Account_Information"/>       <scope input="getCustomerInfo" output="Customer_Information"/>  </scopes>        <xsl:variable name="scopes" select="str:tokenize($scope, ' ')"/>  <ul style="list-style-type:disc">    <li>     <font size="2" style="font-family:verdana">      <xsl:apply-templates select="$scopes[position()]"/>     </font>    </li>  </ul>    

I am trying to print the values of corresponding 'output' attribute of an 'input' attribute as seen in above config as bullet points, using "apply-templates" to an individual token. The template is copied below.

  <xsl:template match="token">      <xsl:if test="$scopeMapping/*[local-name()='scopes']/*[local-name()='scope']/@*[local-name()='input']/text() = normalize-space(.)">            <xsl:value-of select="$scopeMapping/*[local-name()='scopes']/*[local-name()='scope']/@*[local-name()='output']/text()"/>      </xsl:if>  </xsl:template>    

But looks like the xsl code is not working for me. Can someone point out what is wrong and point in right direction?

No comments:

Post a Comment