|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
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 |
|
#2
|
|||
|
|||
|
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
![]() |
|
#3
|
|||
|
|||
|
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"> <xsl aram name="sortby"></xsl aram><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 |
|
#4
|
|||
|
|||
|
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. ![]() |
|
#5
|
|||
|
|||
|
Thanks a lot for that its what i wanted and it looks like its worth learning.
|
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > XML Programming > How do you pass an argument to an xsl stylesheet |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|