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

RE: Problem with substituting XSL @ variable into a hyper link

  • From: Aleksi Niemelä <aleksi.niemela@c...>
  • To: XML-L@l..., xml-dev@i...
  • Date: Fri, 21 Jan 2000 20:05:33 +0100

xsl variable link
<template match = "someElement">
	<a href=http://www.bancal.com/servlet/<xsl:value-of select="@id"/>>
</template>

I think this shouldn't work, since it doesn't look like XML:
- plain <a>-element (without closing tag or />-ending)
- attributes must to have ' or "
- can't nest multiple elements inside element declaration

Then returning original question, few comments:

>	<xsl:template match="Add">
>			<a href="#{@id}"/> Tag 1
>
>	</xsl:template>

Should work! I think this is exactly what our XSLT eats. But it didn't eat
it one month ago. The name of the software we are using is beyond me, but I
have a hunch it could be part of the IBM's product family.

Anyway, there are ways to go around (first is much better IMHO):

<xsl:template match="Add">
    <a>
        <xsl:attribute name="href">
            <xsl:value-of select="@id"/>
        </xsl:attribute>
    </a> Tag 1
</xsl:template>

<xsl:template match="Add">
    <![CDATA[<a href="#]]><xsl:value-of select="@id"/><![CDATA[/>]]> Tag 1
</xsl:template>

One last note: if you're really talking about some @-variables, I don't know
anything at all about them. But if you meant attribute id as in your example
XML, then these should work. 

Be very careful of right terms - variables *have* specific meaning in
context of XSL specification.

    - Aleksi


-----Original Message-----
From: Brandt Dainow [mailto:bd@i...]
Sent: den 21 januari 2000 18:14
To: 'Kieran O'Shea'; XML-L@l...; xml-dev@i...
Subject: RE: Problem with substituting XSL @ variable into a hyper link


You're putting XSL syntax inside HTML.  HTML has no XSL functionality.  What
you want to do is make HTMl part of your XSL output.  Try this something
like this
<template match = "someElement">
	<a href=http://www.bancal.com/servlet/<xsl:value-of select="@id"/>>
</template>

Thus you are wrapping the XSL values with HTML at output level


Brandt Dainow
bd@i...
Internet Etc Ltd
http://www.internet-etc.com

>-----Original Message-----
>From: owner-xml-dev@i... [mailto:owner-xml-dev@i...]On
>Behalf Of
>Kieran O'Shea
>Sent: Friday, January 21, 2000 4:02 PM
>To: 'XML-L@l...'; 'xml-dev@i...'
>Subject: Problem with substituting XSL @ variable into a hyper link
>
>
>Hi,
>	I am trying to display an attribute from an XML
>document in a HREF
><A> tag
>in XSL. The IE5 processor refuses to substitute in the
>variable value and
>instead outputs the variable name
>instead.
>
>	(1)	<a href="http://www.bancal.com/servlet/{@id}">
>
>	The following didn't work either for the <ADD> template
>
>	(2)	<a href="#{@id}"/> Tag 1
>
>	The following XSL command substitutes it in correctly.
>
>	(3)	<xsl:value-of select="@id"/>
>
>
>Could anybody tell me if there is a way to substitute in the
>value of the
>variable in example (1) and (2) please.
>
>
>
>This full code is below.
>
>XML
>
>	<Add id="A1">
>		Add A User
>	</Add>
>	<Delete id="D1">
>		Delete A User
>	</Delete>
>
>XSL
>
>	<xsl:template match="Add">
>			<a href="#{@id}"/> Tag 1
>
>	</xsl:template>
>	<xsl:template match="Delete">
>	<a href="http://www.bancal.com/servlet/{@id}">
>	<xsl:value-of select="@id"/></a>
>
>
>
>
>
>xml-dev: A list for W3C XML Developers. To post,
mailto:xml-dev@i...
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/ or CD-ROM/ISBN
981-02-3594-1
Unsubscribe by posting to majordom@i... the message
unsubscribe xml-dev  (or)
unsubscribe xml-dev your-subscribed-email@your-subscribed-address

Please note: New list subscriptions now closed in preparation for transfer
to OASIS.



xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev@i...
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/ or CD-ROM/ISBN
981-02-3594-1
Unsubscribe by posting to majordom@i... the message
unsubscribe xml-dev  (or)
unsubscribe xml-dev your-subscribed-email@your-subscribed-address

Please note: New list subscriptions now closed in preparation for transfer
to OASIS.

xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev@i...
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/ or CD-ROM/ISBN 981-02-3594-1
Unsubscribe by posting to majordom@i... the message
unsubscribe xml-dev  (or)
unsubscribe xml-dev your-subscribed-email@your-subscribed-address

Please note: New list subscriptions now closed in preparation for transfer to OASIS.



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
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

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.