XSLT : For-each

G

Guest

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>
 
K

Kevin Spencer

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.
 
K

Karl Seguin [MVP]

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
 
J

Jay R. Wren

Redowl said:
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.
 
Joined
Jul 27, 2007
Messages
1
Reaction score
0
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
 

Attachments

  • XSLT.zip
    7.8 KB · Views: 68

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,780
Messages
2,569,608
Members
45,241
Latest member
Lisa1997

Latest Threads

Top