Wrox Programmer Forums
Go Back   Wrox Programmer Forums > XML > XSLT
|
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
 
Old November 29th, 2012, 01:41 AM
Registered User
 
Join Date: Nov 2012
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Reteriving name/text for the passing value

Hi All,

We are encounting a problem while transforming the XSL in Google Chrome browser. Below is the code snippet :

XML :
<message>
<lookup>
<option value="1">abc</option>
<option value="2">abc</option>
<option value="3">abc</option>
</lookup>
</message>

XSL :

<xsl:value-of select="/message/lookup/option[@value=$value]">

Here when we try to parse the xsl in google chrome, it is not understanding the option[@value=$value] part only.

I may have written half code here but my problem is why chrome is not able to fetch the text value for the $value which is being passed.

If you want i can post the exact snippets.

Any help is appricieated.

Thanks in Advance.
 
Old November 29th, 2012, 06:26 AM
Friend of Wrox
 
Join Date: Nov 2007
Posts: 1,243
Thanks: 0
Thanked 245 Times in 244 Posts
Default

Consider to post minimal but complete snippets allowing us to reproduce the problem with Chrome. Have you tried other browsers or XSLT processors? Do they give the result you want? Have you checked Chrome's error console whether it indicates a problem? Without seeing where and how you set $value and a clear description of the result you want and the one you get with Chrome it is hard to help other than asking you to check what I ask for above.
__________________
Martin Honnen
Microsoft MVP (XML, Data Platform Development) 2005/04 - 2013/03
My blog
 
Old November 30th, 2012, 03:38 AM
Registered User
 
Join Date: Nov 2012
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Reteriving name/text for the passing value

Hi Martin Honnen,

Thanks for your reply.

I am posting the dummy code for you to analyze it why it is not working in chrome. We did test the same in other browsers like safari, FF but it is not working in those browsers too.

A.xsl

<xsl:variable name="varLvl">
<xsl:call-template name="getval">
<xsl:with-param name="lookup">level</xsl:with-param>
</xsl:call-template>
</xsl:variable>


<xsl:call-template name="trans">
<xsl:with-param name="lookup" select="$varLvl"/>
<xsl:with-param name="mode">1</xsl:with-param>
<xsl:with-param name="value" select="level"/>
</xsl:call-template>

This is the first xsl which is being transfomred, the "getlookup" and "trans" templates are in the below (b.xsl) file :


b.xsl

<xsl:template name="getval">
<xsl:param name="lookup"/>
<xsl:copy-of select="/Message"/>
</xsl:template>

<xsl:template name="translate">
<xsl:param name="lookup"/>
<xsl:param name="mode"/>
<xsl:param name="value"/>
<xsl:choose>
<xsl:when test="$mode=0">
<xsl:if test="string-length($blank)!=0">
<option value=""></option>
</xsl:if>
<xsl:copy-of select="$lookup/message/lookup"/>
</xsl:when>
<xsl:when test="$mode=1">
<xsl:value-of select="$lookup/message/lookup/option[@value=$value]"/>
</xsl:when>
</xsl:choose>
</xsl:template>

Source XML:

XML :
<message>
<lookup>
<option value="1">abc</option>
<option value="2">abc1</option>
<option value="3">abc2</option>
</lookup>
</message>


Hope this will enable you to investigate further.
 
Old November 30th, 2012, 06:03 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

The most obvious thing wrong is the reference to "/Message" when the element is named "message".
__________________
Michael Kay
http://www.saxonica.com/
Author, XSLT 2.0 and XPath 2.0 Programmer\'s Reference





Similar Threads
Thread Thread Starter Forum Replies Last Post
passing multiline text to the report snansala Crystal Reports 0 October 17th, 2006 08:51 AM
passing parameters from command link to input Text pvsaranya_reddy JSP Basics 0 March 5th, 2006 08:02 AM
Passing string to a text box in search engine rylemer Classic ASP Basics 0 October 26th, 2005 03:23 PM
Passing string to a text box in search engine rylemer ASP.NET 1.0 and 1.1 Professional 2 October 25th, 2005 06:11 PM





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