Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Newby XSLT Question

Status
Not open for further replies.

Tarabin

Programmer
Apr 11, 2002
2
IL
I am a newby to all this.

I want to retrieve the value of an xsl:for-each element by using XML.
I am writing XML based paging and need these results to later re-load the XML/XSLT with new values.
in older XSL (not xslt) I had:

<xsl:apply-templates select=&quot;.//row[index() > 0 $and$ index() < 3]&quot; id='foo'/>

*and then get the value...*

var elem = xslDoc.selectSingleNode(&quot;//xsl:apply-templates[@id='foo']&quot;);
if( elem == null ) return;
var attribs = elem.attributes;
if( attribs == null ) return;
var attr = attribs.getNamedItem('select');
if( attr == null ) return;
var condition = attr.text;

attr.text whould give me &quot; row[index() > 0 $and$ index() < 4] &quot; which is what i'm looking for.

-----------------------------

*Now in XSLT I have...*

<xsl:for-each select=&quot;.//row[position() >= 0 and position() < 3]&quot;>

...and here I try to retrieve the value of the xsl:for-each:

var elem = xslDoc.selectSingleNode(&quot;//xsl:for-each&quot;);
if( elem == null ) return;
var attribs = elem.attributes;
if( attribs == null ) return;
var attr = attribs.getNamedItem(' Help...');

Even if my code did work it would work on any &quot;xsl:for-each&quot; in the page which is not ideal. this was solved in XSL by putting an ID or &quot;Sort by&quot; in the &quot;xsl:apply-templates&quot;, but is seems it can not be done this way in XSLT.

I appreciate any help

Tarabin
tarabin1@yahoo.com

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top