Re: [xsl] Extract String between chars

Subject: Re: [xsl] Extract String between chars
From: "David Carlisle d.p.carlisle@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Tue, 26 Oct 2021 17:18:29 -0000
This is the same as the case you asked the other day.

Given input

<x>Order1#11.11.11.111;Order2#22.22.22.22;Order3#333.3433.3333;</x>

and stylseheet

<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
>

 <xsl:param name="n"/>
 <xsl:template match="x">
  <xsl:value-of
select="substring-before(substring-after(.,concat($n,'#')),';')"/>
 </xsl:template>
</xsl:stylesheet>


Then


$ saxon9 pp2.xml pp2.xsl n=1
<?xml version="1.0" encoding="UTF-8"?>11.11.11.111

and

$ saxon9 pp2.xml pp2.xsl n=3
<?xml version="1.0" encoding="UTF-8"?>333.3433.3333




On Tue, 26 Oct 2021 at 17:59, Prady Prady prady.chin@xxxxxxxxx <
xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx> wrote:

> Team,
>
> I need a template for which, when I pass order number as parameter, I
> should get the corresponding IPs. I need this in *XSLT 1.0*
>
> ===============
> Eg
> Input String : Order1#11.11.11.111;Order2#22.22.22.22;Order3#333.3433.3333;
> Param : Order2
>
> Output:
> 22.22.22.22
>
> Basically it should extract text between # and ; after Order2
> ================
>
> Thank you very much for your help.
> XSL-List info and archive <http://www.mulberrytech.com/xsl/xsl-list>
> EasyUnsubscribe <http://lists.mulberrytech.com/unsub/xsl-list/2739265> (by
> email <>)

Current Thread