XML Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreXML Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old August 24th, 2004, 03:49 AM
J-R J-R is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2004
Posts: 5 J-R User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Selecting an element in xsl sheet

Hi there,

I wanna select the for-each element in the below xsl sheet to write to the attribute select to evaluate an xpath.
However when i do this i get "null error"

path="/business/id[name='MER']/*"
var filterNode = xsl.selectSingleNode("/xsl:stylesheet/xsl:template[@name='main']/xsl:for-each");
filterNode.setAttribute("select", "path");

ANy Ideas please i am really stuck trying to find a way to dynamically evaluate xpath expression and thats the only way i found reasonable.


Thanks in Advance

<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xslaram name="sortby"></xslaram>


<xsl:template name="main" match="/">
<html>
<body>

<h2>ALL RECORDS</h2>
<table border="1">
<tr bgcolor="#9acd32">
<th>Busines Type</th>
<th>Business Name</th>
<th>Street Number</th>
<th>Street Name</th>
<th>Postcode</th>
<th>Suburb</th>
<th>Region</th>
<th>Image</th>
</tr>
<xsl:for-each select="">
<xsl:sort select="type"/>
<xsl:variable name="image"><xsl:value-of select="image"/></xsl:variable>
<tr>
<td><xsl:value-of select="type"/></td>
<td><xsl:value-of select="name"/></td>
<td><xsl:value-of select="stnumber"/></td>
<td><xsl:value-of select="stname"/></td>
<td><xsl:value-of select="postcode"/></td>
<td><xsl:value-of select="suburb"/></td>
<td><xsl:value-of select="region"/></td>
<td> <img src="{image}"></img></td>
</tr>
</xsl:for-each>
</table>
<form name="print">
<input type="button" value="PRINT" onclick="javascript:window.print()"></input>
</form>
</body>
</html>
</xsl:template>

</xsl:stylesheet>

Reply With Quote
  #2  
Old August 26th, 2004, 03:02 PM
kid23 kid23 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 62 kid23 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 5
If i understand well what you're doing, there's a syntax error in your code:

filterNode.setAttribute("select", "path");

This is wrong, you're passing the string "path" as second parameter.. what you're supposed to do is to path the content of the variable named path, so:

filterNode.setAttribute("select", path);

looks more appropriate.

Let me know if this worked or not

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreXML Programming > Selecting an element in xsl sheet


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway
Stay green...Green IT