Re: Q: Attribute value templates

Subject: Re: Q: Attribute value templates
From: "G. Ken Holman" <gkholman@xxxxxxxxxxxxxxxxxxxx>
Date: Mon, 22 Feb 1999 19:54:41 -0800
At 99/02/22 13:54 -0500, Michael J. Koehrsen wrote:
>Is there some way to insert the result of an attribute value template 
>into the character content of an element in the result tree?  

No ... but you can use the same components used an attribute value template
as the arguments to multiple calls to <xsl:value-of>.

>I need to 
>do this because certain syntax, in particular arg() and constant(), 
>is only allowed in an attribute value template.

Not true ... string expressions are also allowed in <xsl:value-of>.

>Specifically, I'm trying to write a macro that takes a filename as an 
>argument and generates an HTML <A> element with an href based on the 
>filename (that part's no problem), and with the filename as the content:
><xsl:macro name="file-link">
>  <xsl:macro-arg name="file-name"/>
>  <A href="{constant(base-url)}/{arg(file-name)}">
><!-- How can I insert file-name here? -->
>  </A>

I've modified your example below.

I hope this helps.

......... Ken

T:\ftemp2>type test.xml
<?xml version="1.0"?>
T:\ftemp2>type test.xsl
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="";>

<xsl:constant name="base-url" value=""/>

<xsl:template match="/">
  <xsl:invoke macro="file-link">
    <xsl:arg name="file-name" value="{/test}"/>

<xsl:macro name="file-link">
  <xsl:macro-arg name="file-name"/>
  <A href="{constant(base-url)}/{arg(file-name)}">
    <xsl:value-of select="constant(base-url)"
    />/<xsl:value-of select="arg(file-name)"/>

T:\ftemp2>call xsl test.xml test.xsl


G. Ken Holman         mailto:gkholman@xxxxxxxxxxxxxxxxxxxx
Crane Softwrights Ltd.
Box 266,                                V: +1(613)489-0999
Kars, Ontario CANADA K0A-2E0            F: +1(613)489-0995
Next XSL Training:      X-Tech:1999-03-07  WWW8:1999-05-11

 XSL-List info and archive:

Current Thread