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

substrings and identical numbers

Subject: substrings and identical numbers
From: tobi02 <tobiasreif@xxxxxxxxxxxxx>
Date: Wed, 09 May 2001 18:04:25 +0200
identical numbers
Hi...

<xsl:transform version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text" encoding="UTF-8" indent="yes"/>
<xsl:template match="/">
<!-- I need to get the first three places. They can be of any length.
Why does only the second one work like expected?
The first one doesn't work if the two numbers are the same.
(uncomment one then the other)
 -->

<!-- XXXXXXXXXXXXXXXXXX first option XXXXXXXXXXXXXXXXXXXX -->
<!--  doesn't work with "a_a_20_20", "a_a_70_70" ....
gives "a_a_" without a number
works only with different numbers: "a_a_20_70"
 -->
<!--
<xsl:variable name="input" select="'a_a_7000_7000'"/>
<xsl:variable name="output"
select="substring-before($input,substring-after(substring-after(substring-after($input,'_'),'_'),'_'))"/>

input: <xsl:value-of select="$input"/>
output: <xsl:value-of select="$output"/>
-->

<!-- XXXXXXXXXXXXXXXXXX second option XXXXXXXXXXXXXXXXXXXX -->
<!--  works correctly.
with "a_a_20_20", "a_a_70_70" .... also with different numbers like
"a_a_7000_9"
gives "a_a_7000_" with a number
-->
<!--
<xsl:variable name="input" select="'a_a_7000_7000'"/>
<xsl:variable name="pic_dir" select="'/images'"/>
<xsl:variable name="place1" select="substring-before($input,'_')"/>
<xsl:variable name="place2"
select="substring-before(substring-after($input,'_'),'_')"/>
<xsl:variable name="place3"
select="substring-before(substring-after(substring-after($input,'_'),'_'),'_')"/>

input: <xsl:value-of select="$input"/>
output: <xsl:value-of select="concat($place1, '_', $place2, '_',
$place3, '_')"/>
-->
</xsl:template>
</xsl:transform>

Tobi


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


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.