|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Q: Attribute value templates
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>
></xsl:macro>
I've modified your example below.
I hope this helps.
......... Ken
T:\ftemp2>type test.xml
<?xml version="1.0"?>
<test>training/</test>
T:\ftemp2>type test.xsl
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl">
<xsl:constant name="base-url" value="http://www.CraneSoftwrights.com"/>
<xsl:template match="/">
<xsl:invoke macro="file-link">
<xsl:arg name="file-name" value="{/test}"/>
</xsl:invoke>
</xsl:template>
<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)"/>
</A>
</xsl:macro>
</xsl:stylesheet>
T:\ftemp2>call xsl test.xml test.xsl
<A
href="http://www.CraneSoftwrights.com/training/">http://www.CraneSoftwrights
.com/training/T:\ftemp2>
--
G. Ken Holman mailto:gkholman@xxxxxxxxxxxxxxxxxxxx
Crane Softwrights Ltd. http://www.CraneSoftwrights.com/s/
Box 266, V: +1(613)489-0999
Kars, Ontario CANADA K0A-2E0 F: +1(613)489-0995
Training: http://www.CraneSoftwrights.com/s/schedule.htm
Resources: http://www.CraneSoftwrights.com/s/resources.htm
Shareware: http://www.CraneSoftwrights.com/s/shareware.htm
Next XSL Training: X-Tech:1999-03-07 WWW8:1999-05-11
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








