[xsl] [Xsl] How to create complex dynamic href with xslt ????

Subject: [xsl] [Xsl] How to create complex dynamic href with xslt ????
From: <pippo@xxxxxxxxxx>
Date: Tue, 1 Mar 2005 19:47:47 +0100
I have a very simple xslt problem but apparently without a solution:

Im using per xml:xslt package (latest version, 0.48) .
Inside an xslt transformation template  I have to generate dynamic
javascript href where some URL parameter depend on input xml document. For
example I have to generate something like:

   <a
href=http://mysite/drv?expert&amp;mod={TEMPLATE}&amp;IDMENU={@MENU_ID}>
dummy  text </a>

where, obvioulsly,  {TEMPLATE} and {@MENU_ID} are attribute value template.
The problem is that the xslt processor is not able to recognize them as
attribute value templates because the syntax is not so plain. Every example
I saw about attribute value template show how to use them in very very
simple situations (not in the real world !!) like the following one:

<person id = "{@id}"/> 

where the attribute value template is well recognizable by the xslt
processor.
To solve my problem I also tried something like:

   &lt;a href=http://mysite/drv?expert&amp;mod=<xsl:value-of
select=TEMPLATE/>&amp;IDMENU=<xsl:value-of select=@MENU_ID/> &gt; dummy
 text &lt;/a&gt;

but, obviously, it generates not correct html syntax ( in fact I have to
produce unescaped <  and > characters ..)
I also tried to use CDATA with a syntax like:

    <![CDATA[<a href=http://mysite/drv?expert&amp;mod=]]><xsl:value-of
select=TEMPLATE/> <![CDATA[&amp;IDMENU=]]><xsl:value-of
select=@MENU_ID/> <![CDATA[> dummy  text </a>]]>

But also in this way I got a wrong result because angle brackets  are
transformed in &lt; / &gt; sequences by the xslt processor.

What is the right way to manage a so stupid transformation ?

Thanks,
      Paolo

Current Thread