xsl-list
[Top] [All Lists]

Re: [xsl] Extract String between chars

2021-10-26 12:18:36
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(_dot_)chin(_at_)gmail(_dot_)com 
<
xsl-list-service(_at_)lists(_dot_)mulberrytech(_dot_)com> 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 <>)

--~----------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
EasyUnsubscribe: http://lists.mulberrytech.com/unsub/xsl-list/1167547
or by email: xsl-list-unsub(_at_)lists(_dot_)mulberrytech(_dot_)com
--~--
<Prev in Thread] Current Thread [Next in Thread>