|
Subject: Re: [xsl] Modify acronym replace "function" From: Sven Waibel <sven.waibel@xxxxxxxx> Date: Fri, 25 Nov 2005 08:13:34 +0100 |
Good morning, good evening and hello!
I got it.
Thanks to all!!!
Cheers
Sven
Here my code:
<xsl:template name="replace-acronyms">
<xsl:param name="acronyms"
select="document('')/xsl:stylesheet/xsl:template[@name='acro']/acronyms/acronym"
/>
<xsl:param name="string" />
<xsl:choose>
<xsl:when test="not($acronyms)">
<xsl:value-of select="$string" />
</xsl:when>
<xsl:when test="not(string($string))" />
<xsl:otherwise>
<xsl:variable name="acronym" select="$acronyms[1]/@acronym" />
<xsl:choose>
<xsl:when test="contains($string, $acronym)">
<xsl:variable name="before" select="substring-before($string,
$acronym)" />
<xsl:variable name="after" select="substring-after($string,
$acronym)" />
<xsl:call-template name="replace-acronyms">
<xsl:with-param name="string" select="$before" />
<xsl:with-param name="acronyms" select="$acronyms[position() > 1]" />
</xsl:call-template>
<xsl:value-of select="$acronyms[1]"/>
<xsl:call-template name="replace-acronyms">
<xsl:with-param name="string" select="$after" />
<xsl:with-param name="acronyms" select="$acronyms" />
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="replace-acronyms">
<xsl:with-param name="string" select="$string" />
<xsl:with-param name="acronyms" select="$acronyms[position() > 1]" />
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="acro">
<acronyms>
<acronym acronym="vorbedingung">PRECONDITION</acronym>
<acronym acronym="Vorbedingung">PRECONDITION</acronym>
<acronym acronym="VORBEDINGUNG">PRECONDITION</acronym>
</acronyms>
</xsl:template>
Ragulf Pickaxe schrieb:
>>><xsl:param name="acronyms"
>>>select="document('')/xsl:stylesheet/xsl:template[@name='acro']/acronyms" />
>>
>>> <xsl:variable name="acronym" select="$acronyms[1]/@acronym" />
>>
>>Your variable would have to look like this "..]/aconyms/acronym"
>
>
> I meant param here (instead of variable). But you can change either.
>
> Ragulf Pickaxe :-)
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| Re: [xsl] Modify acronym replace "f, Ragulf Pickaxe | Thread | RE: [xsl] Generate indexes automati, Dan Powderhill |
| Re: [xsl] FXSL and 'saxon:function(, Dimitre Novatchev | Date | Re: [xsl] second implementation of , Colin Paul Adams |
| Month |