0

I am new to XSLT. I have a requirement where I need to convert an XML file to XSLT. In that, I need to iterate in a loop to get all the values from an XML like

<books>
<book-00>
<science price=""/>
.
.
.
<\book-00>
<book-01>
<english price=""/>
.
.
.

.
<\book-01>
<book-nn>
<\book-nn>
<\books>

How can I write a for loop with the dynamic count by reading it from an XML node into XSLT?

2
  • 1
    Who defined tags like <book-01>? if it not too late try to redefine those tags to <book index="01">, etc. so that you can handle them via <template match="book"> construct. Commented May 5, 2011 at 18:55
  • 1
    A lot of missing significant information: 1. What is the exact output that must be produced. 2. What is meant by "a for loop with the dynamic count by reading it from a xml node in xslt"? Please, edit your question and provide the missing data so that it would make sense. Commented May 6, 2011 at 1:47

1 Answer 1

1

You try to avoid looping with XSLT, opting instead to use templates.

You need to apply an XSLT stylesheet to your XML in order to produce some sort of output (normally a different XML dialect, such as XHTML).

How this is done depends on the language and platform you are using - however, you have not indicated which ones you are using.

I suggest reading up on XSLT before you continue.

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

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.