OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.

 


Help: OASIS Mailing Lists Help | MarkMail Help

docbook-apps message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]


Subject: Re: [docbook-apps] Re: help with xslt


> * Florent Georges <yvfgf@strbetrf.bet> [2008-09-14 23:54:50 +0200]:
>
> Sam Steingold wrote:
>
>> > concat('sec_', translate(substring-before(substring-after(
>> > '#(11 1 2 1 2)', '#('), ')'), ' ', '-'))
>
>> cool - this takes care of the old version (sec_11-1-2-1-2).
>> how about 11_abab?
>
>     concat(
>       substring-after(
>         substring-before('#(11 1 2 1 2)', ' '),
>         '#('),
>       '_',
>       translate(
>         substring-before(
>           substring-after('#(11 1 2 1 2)', ' '),
>           ')'),
>         '123456789 ',
>         'abcdefghi'))
>
>   You can see both in the following XQuery, for what is worth:
>
>     let $in := '#(11 1 2 1 2)'
>     let $nums := substring-before(substring-after($in, '#('), ')')
>     let $old := concat('sec_', translate($nums, ' ', '-'))
>     let $letters := translate(substring-after($nums, ' '),
>                               '123456789 ', 'abcdefghi')
>     let $new := concat(substring-before($nums, ' '), '_', $letters)
>       return
>         <res>
>           <old>{ $old }</old>
>           <new>{ $new }</new>
>         </res>
>
>     ==>
>
>     <?xml version="1.0" encoding="UTF-8"?>
>     <res>
>        <old>sec_11-1-2-1-2</old>
>        <new>11_abab</new>
>     </res>

cool - what software do I type these to?

>   This works only if you have digits from 1 to 9.  If you can
> have 10+, I think you would parse $nums to integers then map
> integers to letters.  And definitively write a function to
> encapsulate and document the funtionality.

exactly! that's the biggie!

-- 
Sam Steingold (http://sds.podval.org/) on Fedora release 9 (Sulphur)
http://openvotingconsortium.org http://truepeace.org http://dhimmi.com
http://thereligionofpeace.com http://memri.org http://mideasttruth.com
People with a good taste are especially appreciated by cannibals.


[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]