[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Modify acronym replace "function"

Subject: Re: Modify acronym replace "function"
From: Sven Waibel <sven.waibel@xxxxxxxx>
Date: Fri, 25 Nov 2005 08:13:34 +0100
name acronym
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

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.