Subject: RE: Global Variables (use of) From: Richard Lander <rlander@xxxxxxxxxxxxx> Date: Fri, 21 Jul 2000 12:23:03 -0700 |
Jason, I think that you would be better served by a named template. How about: <xsl:template name="sectnum"> <xsl:value-of select="title/@id"/> </xsl:template> Then, call the template from where ever you want, with: <xsl:call-template name="sectnum"/> If you need to store the value before using it (something I do all the time), try: <xsl:param name="someparam"> <xsl:call-template name="sectnum"/> </xsl:param> Then grab it with: <xsl:value-of select="$someparam"/> Hope that helps, Rich -----Original Message----- From: Buss, Jason A [mailto:jabuss@xxxxxxxxxxxxxxxxxx] Sent: Friday, July 21, 2000 9:30 AM To: 'xsl-list@xxxxxxxxxxxxxxxx' Subject: Global Variables (use of) If I call an <xsl:variable> just after <xsl:stylesheet> as such: <?xml version='1.0'?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:saxon="http://icl.com/saxon" extension-element-prefixes="saxon" version='1.0' saxon:trace="yes"> <xsl:variable name="sectnum"><xsl:value-of select="child::title/attribute::id"/></xsl:variable> $num should be processed as a global variable (my understanding through the reading I have done). The only thing that should be passed as values are the id attribute values for title within chapters, sections, figures, and the book itself (the only elements that have title as a child). Running this produces nothing (running SAXON with XP). If I place this in the template for one of the elements that contains a title, it evaluates correctly. If I need to build a TOC where all the titles are reproduced as anchors with the id value as the href, do I need to declare a unique variable in each template to make this evaluate correctly, or is there a way I can use a global value that will return the correct id value based on the current node being matched? This is the toughest part of my project I have hit so far (other than getting all these lousy java apps to work correctly). Any help will be appreciated, and a solution will be showered with numerous accolades...... Thanks in advance.... Jason A. Buss Single Engine Technical Publications Cessna Aircraft Company jabuss@xxxxxxxxxxxxxxxxxx In 1992 the Web was a garden of personal home pages blooming with thoughts, opinions, and life experiences. People were learning how to build their own sites, experimenting with design, and sharing their voice with the world while the business world scrambled for ways to "monetize" the internet and capitalize on its fertility. Then they paved it all and built a mall. -Biz Stone XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
Re: Global Variables (use of), Jeni Tennison | Thread | RE: How to get the parent node in a, Kay Michael |
html fragments, Carl Soane | Date | testing...please ignore, Heather Lindsay |
Month |