Iteration using variables

Iteration using variables

Post by Peter Gibbi » Thu, 03 May 2001 19:20:06



I've checked the other postings on variables and tried various solutions but
none seem to solve my problems, so apologies for another posting on
variables.

Here's the problem.

I receive a flat XML document from SOAP which contains all the information I
need to create my menu structure.  I can manipulate it easily enough in code
using recursion to create the 5 levels of menu I need but this takes an age,
so someone suggested using XSL.

The code below is a fragment which I hope gives the general gist of what I'm
trying to do.

<xsl:element name="menu">
  <xsl:attribute name="level">0</xsl:attribute>
  <xsl:attribute name="id">

  </xsl:attribute>

    <xsl:for-each select="xml/data/row">

        <xsl:element name="menu">

I know that menu0id contains a tree fragment but I can't seem to get it into
a string for test.

There's something I'm just not getting.

Any help

Peter Gibbin
Project Analyst
Exel Computer Systems
Nottingham
UK
www.exel.co.uk

 
 
 

1. XMLNodeList dynamic iteration using MSXML

I have an XML like this...

<?xml version="1.0"?>
<Items>
 <Item TYPE="2">X</Item>
 <Item TYPE="1">X</Item>
 <Item TYPE="1">X</Item>
 <Item TYPE="2">X</Item>
 <Item TYPE="2">X</Item>
 <Item TYPE="1">X</Item>
</Items>

I need to sort like this... I am using childNodes method of Items and
checking the attribute Type... If it's value is 1 then I am removing it from
and adding it to the top.  This causes problem while iterating because the
IXMLNodeList is a live object. How can I do this ?

<Items>
 <Item TYPE="1">X</Item>
 <Item TYPE="1">X</Item>
 <Item TYPE="1">X</Item>
 <Item TYPE="2">X</Item>
 <Item TYPE="2">X</Item>
 <Item TYPE="2">X</Item>
</Items>

--
thanks & regards

Shakir H
http://www.netbryx.com
"Unleash the power of XML"

2. Need DXF->CFF2 or CFF2 spec

3. Defining variables using variable values in XSLT.

4. nec 650C comments please

5. Iteration

6. ACLs and Shared Libraries

7. XSLT Iteration problem

8. ricoh 6200 audio recording problems

9. Xpath / controlled iteration for row/column display

10. iteration in XSL

11. hot to limit iterations in for-each

12. XSLT: Problem using variable in XPath statement

13. XSL variables: Setting global variables from subtemplates.