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 22nd, 2004, 04:18 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
How do you pass an argument to an xsl stylesheet

Hi there,

I would like to know how do you pass an argument to an xsl stylesheet . Because i want to pass a variable to an xsl sheet which i wanna carry some conditional tests on.

I am using javascript with Microsoft.XMLDOM and XPATH

Any ideas???

Thanks a lot in advance

Reply With Quote
  #2  
Old August 22nd, 2004, 09:07 AM
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
Hard to give you a straight answer.. your post is a bit vague (no offense). Please describe your problem a bit more, make sure to read xml/xsl tutorials to get some (at least the basics) experience with them. Then we'll be able to help

Reply With Quote
  #3  
Old August 22nd, 2004, 09:51 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
Okay Fair enough i guess the past description is an example.

I got this xsl sheet

<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xslaram name="sortby"></xslaram>


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

<h2>ALL RECORDS</h2>
<table border="0">
<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="/business/id">
<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>
</body>
</html>
</xsl:template>

WHat i wann do is pass the value to the xsl sheet for the sortby parameter when i carry out a transform on a document.

i.e
function displayAll(sortby)
{
// Load XSL
var xsl = new ActiveXObject("Microsoft.XMLDOM")
xsl.async = false
xsl.load("xpertsortbytype.xsl")

// Transform
outputlayer.innerHTML=xmlDoc.transformNode(xsl,its here where i wanna pass sortby to the xsl sheet )


}

I hope that was hopefull in clarifying the situation

Reply With Quote
  #4  
Old August 22nd, 2004, 01:22 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
I think I see what you're trying to do. Haven't done anything similar yet, but you should definitely have a look at sarissa. You'll find what you're looking for in its documentation.

Project page:
http://sourceforge.net/projects/sarissa

Documentation:
http://sarissa.sourceforge.net/

The part that explains the use of parameters:
http://sarissa.sourceforge.net/over...y.html#xslparam

Spend some time on learning sarissa, it's invaluable knowledge if you're looking to have control over transformations by yourself.

Reply With Quote
  #5  
Old August 22nd, 2004, 09:43 PM
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
Thanks a lot for that its what i wanted and it looks like its worth learning.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreXML Programming > How do you pass an argument to an xsl stylesheet


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

 Free IT White Papers!
 
How to Present Effectively Online
This white paper offers practical and actionable advice on the key steps that any presenter should consider as they plan and execute a Webinar or online meeting.

 
Open Source Security Myths
Open Source Software (OSS) is computer software whose source code is available to the general public with relaxed or non-existent intellectual property restrictions (or arrangement such as the public domain), and is usually developed with the input of many contributors.

 
Power and Cooling Capacity Management for Data Centers
This paper describes the principles for achieving power and cooling capacity management.

 
Scalable, Fault-Tolerant NAS for Oracle - The Next Generation
For several years NAS has been evolving as a storage alternative for Oracle databases, and for good reason: NAS is quite often the simplest, most cost-effective storage approach for Oracle. Learn about the benefits that HP's approach to scalable NAS brings to Oracle environments in this comprehensive white paper.

 
Understanding Web Application Security Challenges
This white paper discusses many common threats and preventive measures for Web application security, and explains what you can do to help protect your organization.

 

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





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