Jump to content

can pass value to xsl?


nwaynge

Recommended Posts

hello, can u pass parameter value to xsl?eg...cdcatalog.xml-------------------------------<?xml version="1.0" encoding="ISO-8859-1"?><?xml-stylesheet type="text/xsl" href="cdcatalog.xsl"?><!-- Edited with XML Spy v2007 (http://www.altova.com) --><catalog> <cd> <title>Empire Burlesque</title> <artist>Bob Dylan</artist> <country>USA</country> <company>Columbia</company> <price>10.90</price> <year>1985</year> </cd> <cd> <title>Hide your heart</title> <artist>Bonnie Tyler</artist> <country>UK</country> <company>CBS Records</company> <price>9.90</price> <year>1988</year> </cd> <cd> <title>Greatest Hits</title> <artist>Dolly Parton</artist> <country>USA</country> <company>RCA</company> <price>9.90</price> <year>1982</year> </cd></catalog>cdcatalog.xsl----------------------------------------<?xml version="1.0" encoding="ISO-8859-1"?><!-- Edited with XML Spy v2007 (http://www.altova.com) --><xsl:stylesheet version="1.0"xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:template match="/"> <html> <body> <h2>My CD Collection</h2> <table border="1"> <tr bgcolor="#9acd32"> <th>ID</th> <th>Title</th> <th>Artist</th> </tr> <xsl:for-each select="catalog/cd"> <xsl:if test="price>10"> <tr> <td><xsl:value-of select="title"/></td> <td><xsl:value-of select="artist"/></td> </tr> </xsl:if> </xsl:for-each> </table> </body> </html></xsl:template></xsl:stylesheet>cdcatalog.html----------------------------<html><body><script type="text/javascript">// Load XML var xml = new ActiveXObject("Microsoft.XMLDOM")xml.async = falsexml.load("cdcatalog.xml")// Load the XSLvar xsl = new ActiveXObject("Microsoft.XMLDOM")xsl.async = falsexsl.load("cdcatalog_if.xsl?artist='Bonnie Tyler'")// Transformdocument.write(xml.transformNode(xsl))</script></body></html>//////////////////////////////////////////////i only want to show cdcatalog that the artist name is same as my parameter valuecan i do that?pls help methz

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...