xsl-list
[Top] [All Lists]

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

2005-03-01 11:47:47
I have a very simple xslt problem but apparently without a solution:

I?m 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={(_at_)MENU_ID}?>
dummy ? text </a>

where, obvioulsly,  {TEMPLATE} and {(_at_)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 = "{(_at_)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=?(_at_)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=?(_at_)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


--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



<Prev in Thread] Current Thread [Next in Thread>