Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
| Search | Today's Posts | Mark Forums Read
XSLT General questions and answers about XSLT. For issues strictly specific to the book XSLT 1.1 Programmers Reference, please post to that forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the XSLT section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old May 19th, 2006, 11:45 AM
Authorized User
 
Join Date: Mar 2006
Location: Milwaukee, WI, USA.
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Default What's wrong with this code?

<xsl:choose>
  <xsl:when test="contains($full_url, '?')">
<xsl:value-of select="$full_url"/>&amp;WT.gmini=true&amp;WT.apsearch=<xsl:value-of disable-output-escaping="yes" select="$html_escaped_query"/><xsl:text disable-output-escaping="yes">&amp;WT.searchclick=product_image&q uot;&gt;</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$full_url"/>?WT.gmini=true&amp;WT.apsearch=<xsl:value-of disable-output-escaping="yes" select="$html_escaped_query"/><xsl:text disable-output-escaping="yes">&amp;WT.searchclick=product_image&q uot;&gt;</xsl:text>
</xsl:otherwise>
</xsl:choose>

Well, actually I know the problem is the ? in the second line because if I change that to some other text that appears in the full_url then it works fine. Why can't I search for a ? in a url? Or how do I do it properly?

Thanks.

Al Dugan
www.atomicpark.com
__________________
Al Dugan
www.atomicpark.com
  #2 (permalink)  
Old May 19th, 2006, 11:51 AM
Authorized User
 
Join Date: Mar 2006
Location: Milwaukee, WI, USA.
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Nevermind...

%3F instead of the ? works

Al Dugan
www.atomicpark.com
  #3 (permalink)  
Old May 19th, 2006, 11:53 AM
mhkay's Avatar
Wrox Author
Points: 18,487, Level: 59
Points: 18,487, Level: 59 Points: 18,487, Level: 59 Points: 18,487, Level: 59
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2004
Location: Reading, Berks, United Kingdom.
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

I was going to say "What's wrong with this code is that it uses disable-output-escaping" - as that's often a symptom of poor XSLT programming. However, there's nothing wrong with the contains($x, '?') expression. Either your assumptions are wrong, and you're testing the wrong condition, or your processor has a bug. Given that you haven't actually provided any *evidence* that it's not working (you've only asserted the fact) my initial assumption would be that the error is in part of the code that you haven't shown us.

Michael Kay
http://www.saxonica.com/
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference
  #4 (permalink)  
Old May 19th, 2006, 12:06 PM
Authorized User
 
Join Date: Mar 2006
Location: Milwaukee, WI, USA.
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I know, I know.. I've been scolded here before for having ugly "disable-output-escaping" code... but this is not my fault, it's for the Google Mini search appliance and that is how all of their code is written... I'm simply working with what I've got.

Al Dugan
www.atomicpark.com


Similar Threads
Thread Thread Starter Forum Replies Last Post
what's wrong with my code? DyerOppenheimer BOOK: Beginning Ajax with ASP.NET 0 January 7th, 2008 08:46 AM
What's wrong with this code? appleseed C++ Programming 2 November 25th, 2006 08:17 AM
What is wrong with code? rtr1900 Classic ASP Databases 1 April 3rd, 2006 03:20 AM
What is wrong with this code? SaharaWizard VB Databases Basics 2 January 28th, 2006 08:20 AM
what's wrong with this code? miguel.ossa ASP.NET 1.0 and 1.1 Basics 2 January 21st, 2004 11:33 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.