Re: [xsl] String manipulation in Xslt 1.0

Subject: Re: [xsl] String manipulation in Xslt 1.0
From: "Prady Prady prady.chin@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Tue, 25 Aug 2020 20:52:56 -0000
*Input 1: *

<Payments>
<Payment>
<invoiceDetails>order1#amt1;order2#amt2;</invoiceDetails>
</Payment>
</Payments>

*Output1:  Should be  like the below : remove  #amt1   #amt2 *
* -> Only want order1;order2*

<Payments>
<Payment>
<invoiceDetails>order1;order2</invoiceDetails>
</Payment>
</Payments>

*Input 2: *
<Payments>
<Payment>
<invoiceDetails>order1#amt1</invoiceDetails>
</Payment>
</Payments>

*Output2:*
  <Payments>
<Payment>
<invoiceDetails>order1</invoiceDetails>
</Payment>
</Payments>

On Tue, 25 Aug 2020 at 13:28, Liam R. E. Quin liam@xxxxxxxxxxxxxxxx <
xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:

> On Tue, 2020-08-25 at 16:29 +0000, Prady Prady prady.chin@xxxxxxxxx
> wrote:
> > Thank you.. But don't I have to loop thru?
> Oh - ok.
>
> Setting aside my usual rant about XSLt not having loops as such :-) in
> XSLT 1 i'd write a recursive template.
>
> There's no ':' in your input - if you provide a real example we can
> give you a working answer. Does # stand for a number? a digit? is "amt"
> always the literal string 'amt' or is it a number? And so on.
>
> Liam
>
> > Eg input :
> >
> > Input:
> >
> > <Payments>
> >
> > <Payment>
> >
> > <invoiceDetails>order1#amt1;order2#amt2;</invoiceDetails>
> >
> > </Payment>
> >
> > </Payments>
> >
> > Output:
> >
> > <Payments>
> >
> > <Payment>
> >
> > <invoiceDetails>order1;order2</invoiceDetails>
> >
> > </Payment>
> >
> > </Payments>
> >
> >
> > On Tue, 25 Aug 2020 at 12:23, Liam R. E. Quin liam@xxxxxxxxxxxxxxxx <
> > xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:
> >
> > > On Tue, 2020-08-25 at 15:46 +0000, Prady Prady prady.chin@xxxxxxxxx
> > > wrote:
> > > > Team,
> > > >
> > > > I need  to delete string between b:b and b;b
> > >
> > > Some implementations (including xsltproc) have a regular expression
> > > replace facility.
> > >
> > > Otherwise, you could use,
> > >    concat(
> > >       substring-before(., ':'),
> > >       ';',
> > >       substring-after(., ';')
> > >    )
> > >
> > > Liam
> > >
> > > --
> > > Liam Quin, https://www.delightfulcomputing.com/
> > > Available for XML/Document/Information Architecture/XSLT/
> > > XSL/XQuery/Web/Text Processing/A11Y training, work & consulting.
> > > Barefoot Web-slave, antique illustrations:
> > > http://www.fromoldbooks.org
> > >
> > >
> >
>
> --
> Liam Quin, https://www.delightfulcomputing.com/
> Available for XML/Document/Information Architecture/XSLT/
> XSL/XQuery/Web/Text Processing/A11Y training, work & consulting.
> Barefoot Web-slave, antique illustrations:  http://www.fromoldbooks.org

Current Thread