Altova Mailing List Archives>Archive Index >comp.text.xml Archive Home >Recent entries >Thread Prev - Re: and xsl >Thread Next - Re: and xsl
In article <45c757a5$1@kcnews01>,
Joseph Kesselman <keshlam-nospam@c...> wrote:
> <a target="_blank">
> <xsl:attribute name="href">
> <xsl:apply-templates select="key[text()='Location']"
> mode="getValue" /> "
>
> ... in other words, create the <a> element, then add an attribute that
> has a computed value.
ok, I got it. But now I'm having some trouble making a substitution,
here's some code:
<xsl:template match="dict">
<div>
<div class="name">
<a target="_blank">
<xsl:attribute name="href">
<xsl:apply-templates select="key[text()='Location']"
mode="getAsUri"/>
</xsl:attribute>
<xsl:apply-templates select="key[text()='Name']" mode="getValue" />
<xsl:text> </xsl:text>
</a>
</div>
</div>
</xsl:template>
<xsl:template match="key" mode="getValue">
<xsl:value-of select="following-sibling::*[1]" />
</xsl:template>
<xsl:template match="key" mode="getAsUri">
<xsl:variable name="txt">
<xsl:apply-templates select="." mode="getValue" />
</xsl:variable>
<xsl:text>http://127.0.0.1:8000/</xsl:text>
<xsl:value-of select="substring-after($txt,'file:///')"
disable-output-escaping="yes" />
</xsl:template>
It should turn:
file:///Users/etc...
to:
http://127.0.0.1:8000/Users/etc...
sadly, it doesn't work properly as I only get http://127.0.0.1:8000/
without the /Users/etc... part
I can't work out what is wrong with the code
any help?
thanks
| ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
