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 September 18th, 2008, 07:49 AM
Registered User
 
Join Date: Sep 2008
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default How to use variable in path?

Hello, i have a problem with using predefined variable in path. I think it's my syntax...
Mb someone know's how make it work?

Code:
<xsl:template name="makeField">
<xsl:param name="FieldType" />
<xsl:param name="FieldName" />
<xsl:param name="FieldCaption" />

<input type="text" name="{$FieldName}[min]" size="4" value="{//page/selected/$FieldName/@min}" class="tx"/>
</xsl:template>
 
Old September 18th, 2008, 08:59 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

Variables can only be used in XPath in place of a value, not in place of an arbitrary part of the expression text. (They are like variables in Java or C#, not like variables in a shell script.)

So you want

page/selected/*[name()=$FieldName]/@min

Michael Kay
http://www.saxonica.com/
Author, XSLT 2.0 and XPath 2.0 Programmer's Reference
 
Old September 18th, 2008, 09:08 AM
Registered User
 
Join Date: Sep 2008
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks!)






Similar Threads
Thread Thread Starter Forum Replies Last Post
value from a xml path in a variable ?? TPP XSLT 2 June 23rd, 2006 03:11 AM
Convert logical path to absolute path zoostar J2EE 1 April 15th, 2005 10:36 AM
Variable Path in web.Config Connection String? ElPato General .NET 4 June 21st, 2004 05:44 PM
Appending to PATH environment variable jacob C# 1 February 9th, 2004 10:43 AM





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