1

I have a XML and I need to find some data from that using xslt,Here is the XML

<root>

  <product>
    <id>134021</id>
    <bulkdiscountpricelist ></bulkdiscountpricelist>
    <webout extra="webout">1</webout>
  </product>

  <product>
    <id>134022</id>
    <bulkdiscountpricelist ></bulkdiscountpricelist>
    <webout extra="webout">0</webout>
  </product>

  <product>
    <id>134023</id>
    <bulkdiscountpricelist ></bulkdiscountpricelist>
    <webout extra="webout">1</webout>
  </product>


  <product>
    <id>134023</id>
    <bulkdiscountpricelist ></bulkdiscountpricelist>
    <webout extra="webout">0</webout>
  </product>

</root>

I want to check each id that has webout=1 using XSLT.

I tried a code but it is not working. My code is like

<xsl:value-of select="$result//product/id"/>
1
  • We can't answer this without more code. What is $result ? Commented May 16, 2013 at 10:02

3 Answers 3

2

It sounds like you need write a template like this

<xsl:template match="product[webout=1]">

to process all the relevant product elements.

We can't really help you more unless you describe what you are doing better. Where has your variable $result come from? You can't examine the contents of a variable like that unless you have the set-node extension in your XSLT transformer.

Sign up to request clarification or add additional context in comments.

Comments

0

You can filter it by for-each like

<xsl:for-each select="/root/product[./webout=1]">
     <xsl:value-of select="id"/>
</xsl:for-each>

Comments

-1

Use something like $result//product[webout=1]/id in xslt "1.1" otherwise use node-set() extension function to get output.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.