XSLT : For-each

Discussion in 'ASP .Net' started by =?Utf-8?B?UmVkb3ds?=, Feb 14, 2006.

  1. Hi,

    Not sure if this is the right forum, but does anybody have any experience of
    using a XSLT variable in a xsl:for-each loop.

    As in, I want to pass in a variable called source which itself holds the
    root of the data I wish to loop through.

    <xsl:for-each select = "$source">
    ' Do something
    </xsl:for-each>
     
    =?Utf-8?B?UmVkb3ds?=, Feb 14, 2006
    #1
    1. Advertising

  2. =?Utf-8?B?UmVkb3ds?=

    Rote Rote Guest

    Rote Rote, Feb 14, 2006
    #2
    1. Advertising

  3. You use a template. Example:

    <xsl:template select="XPathToElements">
    <!-- whatever you want to do -->
    </xsl:template>

    --
    HTH,

    Kevin Spencer
    Microsoft MVP
    ..Net Developer
    We got a sick zebra a hat,
    you ultimate tuna.


    "Redowl" <> wrote in message
    news:...
    > Hi,
    >
    > Not sure if this is the right forum, but does anybody have any experience
    > of
    > using a XSLT variable in a xsl:for-each loop.
    >
    > As in, I want to pass in a variable called source which itself holds the
    > root of the data I wish to loop through.
    >
    > <xsl:for-each select = "$source">
    > ' Do something
    > </xsl:for-each>
    >
    >
     
    Kevin Spencer, Feb 14, 2006
    #3
  4. Not really the right group, but..

    <xsl:variable name="xpath" select="//link" />

    <xsl:for-each select="$xpath">

    </xsl:for-each>


    should work

    now, if you want the variable to be driven from ASP.NET, ur in a totally
    different league. You pretty much need to rename your xsl to aspx, make your
    xml file point to the aspx file, change the content type of yoru aspx file
    to whatever xsl needs to be and then you can simply use something like

    select="<%=myXPath%>"


    Karl

    --
    http://www.openmymind.net/



    "Redowl" <> wrote in message
    news:...
    > Hi,
    >
    > Not sure if this is the right forum, but does anybody have any experience
    > of
    > using a XSLT variable in a xsl:for-each loop.
    >
    > As in, I want to pass in a variable called source which itself holds the
    > root of the data I wish to loop through.
    >
    > <xsl:for-each select = "$source">
    > ' Do something
    > </xsl:for-each>
    >
    >
     
    Karl Seguin [MVP], Feb 14, 2006
    #4
  5. =?Utf-8?B?UmVkb3ds?=

    Jay R. Wren Guest

    Redowl wrote:
    > Hi,
    >
    > Not sure if this is the right forum, but does anybody have any experience of
    > using a XSLT variable in a xsl:for-each loop.
    >
    > As in, I want to pass in a variable called source which itself holds the
    > root of the data I wish to loop through.
    >
    > <xsl:for-each select = "$source">
    > ' Do something
    > </xsl:for-each>
    >
    >


    There is a microsoft.public.xsl group which has tons of QA. You could
    become an XSL expert just following along in that group. This for-each
    question is answered many times over in that group. Very high
    signal/noise there.

    --
    Jay R. Wren
     
    Jay R. Wren, Feb 14, 2006
    #5
  6. =?Utf-8?B?UmVkb3ds?=

    arumahi

    Joined:
    Jul 27, 2007
    Messages:
    1
    xslt for tree structure

    Hi All ,

    I am struggling with a problem in xslt i have an xml file and xslts which have to display the content as text and tree directory structure with contents. I have got a code for displaying the tree structure from internet and i have to change the xslt to call the code for displaying the tree structure. could anyone please help me with this problem. I am here with xml , xslts and the code (.js) for displaying the tree structure.

    Any help would be appreciated. I have attached the zipfile with all the necessary docs.
    The problem I am getting all the values from xml but its not forming the tree structure i didnt understand why this happening.

    bye
    Aruna.G
     

    Attached Files:

    arumahi, Sep 3, 2007
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. John Blair
    Replies:
    1
    Views:
    411
    Eliyahu Goldin
    Aug 3, 2005
  2. Tjerk Wolterink

    xsl:for-each for each 3 elements problem

    Tjerk Wolterink, Nov 3, 2004, in forum: XML
    Replies:
    3
    Views:
    429
    Tjerk Wolterink
    Nov 3, 2004
  3. Pat Maddox
    Replies:
    6
    Views:
    157
    Marcin Mielżyński
    Jan 20, 2006
  4. Igor Nn
    Replies:
    7
    Views:
    437
    Johnny Morrice
    May 28, 2011
  5. PerlFAQ Server
    Replies:
    0
    Views:
    139
    PerlFAQ Server
    Jan 26, 2011
Loading...

Share This Page