|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Modify acronym replace "function"
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 :-)
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








