[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

RE: Variable construction

Subject: RE: Variable construction
From: "Michael Kay" <mike@xxxxxxxxxxxx>
Date: Wed, 21 Sep 2005 15:18:45 +0100
xsl variable url
> I have a piece of text containing a variable. The variable is a url
> specified in an external document...

You mean your source document contains $helpUrl and you want to replace it
with the value of the variable $helpUrl defined in your stylesheet?

Sounds a reasonable thing to do - except that the scope of a variable name
is confined to certain parts of the stylesheet, and doesn't extend to the
source document. At run-time there is no way of getting the value of a
variable whose name you've just read from the source document.

You might as well use any symbolic name in the source document, for example
href="%%helpUrl%%", and in the stylesheet you will need some kind of lookup
mechanism of the form

<xsl:when test="@href='%%helpURL%%'">
  <xsl:attribute
name="href">http://info.uwe.ac.uk/myuwe/myMarks.asp</xsl:attribute>
</xsl:when>

But perhaps I've completely misunderstood what you are trying to do.

Michael Kay
http://www.saxonica.com/


> 
> The text...
> 
> .....If you have any queries, please contact your <a target="_blank"
> href="{$helpUrl}">Faculty Office</a> without delay....
> 
> How should I construct the variable so as to output the url? 
> Can I do it as
> xsl:text?
> 
> The variable...
> 
> <xsl:variable name="helpUrl">
>       <xsl:text>http://info.uwe.ac.uk/myuwe/myMarks.asp</xsl:text>
> </xsl:variable>
> 
> Thanks...
> 
> Aaron
> 
> ..................................................................
> 
> Aaron Johnson
> GUI / XSLT development
> Academic Technologies Group [ATG]
> University of the West of England
> 0117 3281051 [ext: 81051]
> atg.uwe.ac.uk/aaron
> 
> SECURITY POLICY:
> 
> Please note that ATG will only accept
> e-mail attachments in the following
> formats: 
> 
> .asp,.bin,.doc,.gif,.html,.jpg,.mdb,.png,
> .psd,.shtml,.sdf,.sit,.xls,.xml,.xsd,.xsl,.zip,
> 
> ..................................................................
> 
> This communication is intended solely
> for the use of the individual(s) to whom
> it is addressed. Any opinions presented
> are those of the author and do not
> necessarily represent the University of
> the West of England, Bristol.
> ..................................................................
> 
> 
> 
> This email has been independently scanned for viruses and any 
> virus software has been removed using McAfee anti-virus software

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.