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 March 7th, 2014, 06:52 PM
Authorized User
 
Join Date: Mar 2014
Posts: 26
Thanks: 2
Thanked 0 Times in 0 Posts
Default newbie question: what do $ and @ mean?

Hello,

I'm a complete newbie to XSL, and I need to ask some newbie questions:

I've got this line from an XSL file:

<xsl:value-of select="$lureportcaptions[@CAPTIONID=1]/@CAPTION" />

What does the $ and the @ mean?
 
Old March 8th, 2014, 06:21 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

This is not the way to learn a programming language.

Did you know that Wrox Press, whose forum you are using, publishes books? And that the purpose of the forum is to enable people who read these books to ask for further information and clarification?

I think you are trying to learn XPath by staring at examples, guessing what it might mean, and asking questions if you can't guess. I can tell you that you will never master XPath that way.

Get yourself a book that suits your learning style, read it, and then come back with questions if you are still stuck.
__________________
Michael Kay
http://www.saxonica.com/
Author, XSLT 2.0 and XPath 2.0 Programmer\'s Reference
 
Old March 11th, 2014, 09:56 AM
Authorized User
 
Join Date: Mar 2014
Posts: 26
Thanks: 2
Thanked 0 Times in 0 Posts
Default

I would do that if I had time, but I don't... and google won't help me.
 
Old March 11th, 2014, 10:14 AM
mhkay's Avatar
Wrox Author
 
Join Date: Apr 2004
Posts: 4,962
Thanks: 0
Thanked 292 Times in 287 Posts
Default

If you're short of time, it's even more important to understand what you are doing.
__________________
Michael Kay
http://www.saxonica.com/
Author, XSLT 2.0 and XPath 2.0 Programmer\'s Reference
 
Old March 28th, 2014, 05:42 AM
Authorized User
 
Join Date: Jun 2012
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
Originally Posted by gib65 View Post
Hello,

I'm a complete newbie to XSL, and I need to ask some newbie questions:

I've got this line from an XSL file:

<xsl:value-of select="$lureportcaptions[@CAPTIONID=1]/@CAPTION" />

What does the $ and the @ mean?

$ , when you declare a variable for example:
<xsl:variable name="dollar-to-know" select="//dollar"/>

to call that variable, whether it may be global or local variable, dollar symbol will used to call that vairbale in template level.

<xsl:template match="variable">
<xsl:value-of select="$dollar-to-know"/>
</xsl:template>

@ is used to declare or call attribute from the element.

in your example.
<xsl:value-of select="$lureportcaptions[@CAPTIONID=1]/@CAPTION" />

they are calling the variable 'lureportcaptions'/atrribute captionid/value of attribute caption.

input file may be like this.

<lureportcaptions captionid=1 caption="somevalue">

output will get- "somevalue"

Last edited by xsltstarter; March 28th, 2014 at 05:45 AM..
 
Old March 28th, 2014, 09:57 AM
Authorized User
 
Join Date: Mar 2014
Posts: 26
Thanks: 2
Thanked 0 Times in 0 Posts
Default

thank you xsltstarter.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Newbie (very newbie!) question about com.paad.* jkcashin BOOK: Professional Android 2 Application Development 3 June 5th, 2013 06:52 AM
Newbie question peterh Classic ASP Databases 3 January 17th, 2008 12:25 PM
Newbie Question - Sorry! KP Crystal Reports 1 June 13th, 2006 02:45 AM
C# Newbie Question jazzcatone ASP.NET 2.0 Basics 1 May 25th, 2006 10:18 PM
Newbie question maccer88 Access 1 October 18th, 2003 05:53 PM





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