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:
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  
Old April 21st, 2003, 10:00 PM
Pahikua Pahikua is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2002
Posts: 31 Pahikua User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 32 m 46 sec
Reputation Power: 6
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.

Reply With Quote
  #2  
Old April 21st, 2003, 10:30 PM
Pahikua Pahikua is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2002
Posts: 31 Pahikua User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 32 m 46 sec
Reputation Power: 6
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.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreXML Programming > xslt, passing attributes through a url


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


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





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway