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

Re: replace a string that is in between two specific

Subject: Re: replace a string that is in between two specific chars in XSLT 1.0
From: "Prady Prady prady.chin@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Mon, 18 Oct 2021 11:13:22 -0000
Re:  replace a string that is in between two specific
Thank you very much for your reply, David.

As you guessed, input string can have any number of ; and # => any
number of ; and # and you want to delete any text between adjacent #
and ; (as the title of the thread implies

To further clarify:  aaa#bbbb;ccc#dd;
1. ';' marks the end of each set : eg: set 1 :  aaa#bbbb  Set 2 : ccc#dd;
2. Each set has '#' as the demarcation : for eg:  token 1 : aaa and token
2 : bbbb

Thank you for your help again!




On Thu, 14 Oct 2021 at 06:24, David Carlisle d.p.carlisle@xxxxxxxxx <
xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:

> On Thu, 14 Oct 2021 at 11:05, Prady Prady prady.chin@xxxxxxxxx
> <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:
> >
> > Thank you for the response,  Michael!
> >
> > But Oracle BPEL 2.0 does not support XSLT 3.0. It only supports XSLT 1.0
>
> It would help if you clarified your question as your expected result
> doesn't match the transformation you ask for.
>
> Is the input always of the form
>
> aaa#bbbb;ccc#ddd
>
> with one ; and two #  (as in the example you show) or can you have any
> number of ; and # and you want to delete any text between adjacent #
> and ; (as the title of the thread implies)?
>
> Especially with xslt1 which has no regex replace doing the first which
> doesn't require any searching and looping is significantly simpler,
> basically
>
> <xsl:value-of select="substring-before(.,'#')"/>
> <xsl:text>;</xsl:text>
> <xsl:value-of select="substring-before(substring-after(.,';'),'#')"/>
>
> will produce aaa;ccc  if . is the string above.
>
> David
>
>
> David
>
> >
> > Any help using XSLT 1.0 is greatly appreciated
> >
> > On Wed, 13 Oct 2021 at 13:43, Michael MC<ller-Hillebrand mmh@xxxxxxxxx <
> xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:
> >>
> >> Hi Prady,
> >>
> >> Assuming you meant "string split by ;" I came up with this template
> doing the work:
> >>
> >>   <xsl:template match="Ip">
> >>     <xsl:variable name="entries" select="tokenize(text(), '\s*;\s*')"
> as="xs:string*"/>
> >>     <xsl:element name="nums" namespace="http://xmlns.ieee.org/V2">
> >>       <xsl:value-of select="($entries ! substring-before(., '#')) =>
> string-join(';')" />
> >>     </xsl:element>
> >>   </xsl:template>
> >>
> >> It uses XSLT 3 features, because they are so great, and b frankly b
I
> am not motivated to do this using XSLT1. This will most probably involve a
> recursive template using substring-before and substring-after.
> >>
> >> - Michael
> >>
> >>
> >> Am 13.10.2021 um 17:32 schrieb Prady Prady prady.chin@xxxxxxxxx <
> xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>:
> >>
> >> Team,
> >>
> >>
> >> Can somebody help me to replace string that is in between # and ; with
> blank. I need to include this is oracle bpel which only supports xslt 1.0
> >>
> >> From:
> >> <IpsCollection xmlns="http://xmlns.oracle.com/aa">
> >> <Ips>
> >>   <Ip>q1#11.11.11.111;q2#22.22.22.22</Ip>
> >> </Ips>
> >>  </IpsCollection>
> >> To:
> >>  <v2:Ops xmlns:v2="http://xmlns.ieee.org/V2">
> >> <v2:nums>q1;q2</v2:nums>
> >>  </v2:Ops>
> >>
> >>
> >> Thank you very much for your help!
> >>
> >>
> >> XSL-List info and archive
> >> EasyUnsubscribe (by email)
> >
> > XSL-List info and archive
> > EasyUnsubscribe (by email)

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.