|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
SlickEdit: Code in over 40 languages across 7 platforms. SlickEdit’s unmatched power, speed, and flexibility allows even the most accomplished developers to write better code faster. Download a free trial today! |
|
#1
|
||||
|
||||
|
Is there any way to pass an arguement to XSL?
I'm using PHP to output a document stored in an XML file. The file holds multiple documents held within a <documents> node - as such: Code:
<documents>
<document name="one"><![CDATA[ /* stuff */ ]]></document>
<document name="two"><![CDATA[ /* stuff */ ]]></document>
<document hame="three"><![CDATA[ /* stuff */ ]]></document>
</documents>
Can I pass a arguement to pull out the document with the name "two"? I don't want to hard code it, because it will change depending on the request.
__________________
R.T.F.M - Its the only way to fly... "No matter what you do, or how good it is, someone will always ask for more features. Or to change the colour of something, then change their minds." Personal: experience// 8 Years Web Development technologies// Standards-compliant, valid, & accessible (x)HTML/CSS, XML/XSL/XPath/XQuery/XUpdate, (OOP) PHP/(My)SQL, eXist/Xindice/XMLDBs packages// Photoshop, Illustrator, Flash/Fireworks/Director environment// FC2, MySQL, Lighttpd, PHP5, Mojavi/Agavi site// //refactored.net/ (Coming soon...) quote// Programming is the eternal competition between programmers who try to make apps more and more idiot proof and the universe that makes dumber idiots. So far, the universe is winning... |
|
#2
|
||||
|
||||
|
Assuming you're using PHP's XSLT Functions ...
PHP Code:
Code:
<?xml version="1.0" encoding="ISO-8859-1"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:param name="foo" /> <xsl:template match="/"> <xsl:value-of select="$foo"> <!-- $foo can also be used in XPath in the select --> </xsl:template> </xsl:stylesheet>
__________________
# Jeremy Explain your problem instead of asking how to do what you decided was the solution. |
|
#3
|
||||
|
||||
|
in the line:
Code:
<xsl:value-of select="$foo" /> is $foo a PHP variable, or is it true XSL? Forgetting about PHP for a moment, is is possible to create <xsl:param> tags and call them using $[param name]? Last edited by neobuddah : September 12th, 2003 at 07:28 AM. |
|
#4
|
||||
|
||||
|
Is there another way of doing it, so I don't have to use the $ sign?
|
|
#5
|
|||
|
|||
|
Code:
<xsl:value-of select="$foo" /> is pure xsl. What php is doing is passing the xsl a parameter, read by the line Code:
<xsl:param name="foo" /> |
|
#6
|
||||
|
||||
|
Quote:
Lots of good examples and information at www.w3schools.com . |
|
#7
|
|||
|
|||
|
How would you do the same thing (pass a parameter from a PHP file containing XML info to an XSL file that applies to the XML) without using the XSLT functions? The server I have to use doesn't have them installed.
|
|
#8
|
||||
|
||||
|
Quote:
Quote:
|
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > XML Programming > Pass arguements to XSL sheet? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|