|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Generate data entry and reporting .NET Web apps in minutes, straight from your database. Read our FREE whitepaper “Build Web 2.0 Applications Without Hand-Coding” Download now! |
|
#1
|
|||
|
|||
|
xslt, passing attributes through a url
What I am trying to do is pass variables along with a url like this:
<a href="some_where.php?some_var=howdy">some text</a> Easy enough but I can't get it to work with xslt. Here is clip of the xslt file: <xsl:template match="previous"> <xsl:choose> <xsl:when test="@offset=''"><xsl:value-of select="."/></xsl:when> <xsl: otherwise><a href="search.php?offset={@offset}&query={@query}"><xsl:value-of select="."/></a></xsl: otherwise> </xsl:choose> </xsl:template> The data that needs to be passed is contained in the 'previous' nodes attributes. I tried including them using {@attribute_name} but no go. This is the error I get: Warning: Sablotron error on line 125: XML parser error 4: not well-formed (invalid token) in /Users/mikey/Sites/hawaii_rentals_new/search.php on line 201 An error ocurred: XML parser error 4: not well-formed (invalid token)(error code 2) How can I grab those attribute and pass them along with that url? I think it's breaking on the '&' symbol in the url but I don't know how to get around that. Mahalo for any help Last edited by Pahikua : April 21st, 2003 at 10:12 PM. |
|
#2
|
|||
|
|||
|
Figured it out. It was breaking on the '&' sign. So I replaced it with '& amp;' and now I can happily pass vars through the url like this:
<xsl:template match="pages"> <xsl:for-each select="page"> <xsl:choose> <xsl:when test="@offset='' "><xsl:value-of select="."/></xsl:when> <xsl: otherwise><a href="search.php?offset={@offset}&query={@query}"><xsl:value-of select="."/></a></xsl: otherwise> </xsl:choose> </xsl:for-each> </xsl:template> Last edited by Pahikua : April 21st, 2003 at 10:36 PM. |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > XML Programming > xslt, passing attributes through a url |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|