Hi,
I worked out an XSL template that rewrites all hyperlinks on an HTML page, containing a certain substring in the href attribute. It looks like this:
<xsl:template match="A[contains(@href, 'asp')]">
<a>
<xsl:attribute name="href">
<xsl:value-of select="bridge:linkFrom($bridge, $base, @href, 'intranet')" />
</xsl:attribute>
<xsl:apply-templates select="node()" />
</a>
</xsl:template>
I'm not liking the fact that I must recreate the A element from scratch. I know you can do something like this:
<xsl:template match="A/@href">
<xsl:attribute name="href">
<xsl:value-of select="bridge:linkFrom($bridge, $base, ., 'intranet')" />
</xsl:attribute>
</xsl:template>
But how should I merge these two together? I tried f.e. this and it doesn't work (the element does not get selected):
<xsl:template match="A[contains(@href, 'asp')]/@href">
<xsl:attribute name="href">
<xsl:value-of select="bridge:linkFrom($bridge, $base, ., 'intranet')" />
</xsl:attribute>
</xsl:template>
Any help is much appreciated!