|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Substring a Value
Hi Trevor,
> where, <xsl:value-of select="@from"/> (the value returned) needs to be
> substringed(2, len(@from)-1).
The example you gave was "ID(0DP_12345)" from which you wanted
"ODP_12345". In XPath syntax, you need:
substring(@from, 4, string-length(@from) - 4)
The first argument is the string you want to substring. The second is
the index of the first character in the substring that you want (XPath
counts from 1 rather than 0). The third argument is the *length* of
the substring that you want.
Alternatively, you could use:
substring-before(substring-after(@from, 'ID('), ')')
which is easier if you can't count so well!
> I have tried several JavaScripts, but I can't seem to get anything
> to work.
You're using XSLT, not Javascript. Take a look at the XPath quick
reference from: http://www.mulberrytech.com/quickref/index.html
> <xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl">
Oh, I take it back, you're not using XSLT at all, but WD-xsl, the
defunct dialect once used in IE. Take a look at the MSXML FAQ at:
http://www.netcrucible.com/xslt/msxml-faq.htm
Cheers,
Jeni
---
Jeni Tennison
http://www.jenitennison.com/
|
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








