xsl-list
[Top] [All Lists]

Re: [xsl] Re: Need help with tokenize functionality in XSLT 1.0

2020-08-20 03:38:06
Wouahou ! car, cdr ! I haven't seen this since... I can't remember !

Nice to see old things are still usefull !

Best,
Christophe

Le 19/08/2020 à 18:35, David Carlisle d(_dot_)p(_dot_)carlisle(_at_)gmail(_dot_)com a 
écrit :

So last century we's have done

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

<xsl:template match="Payments">
 <Orders>
  <xsl:apply-templates/>
 </Orders>
</xsl:template>


<xsl:template match="Payment">
 <xsl:param name="details" select="invoiceDetails"/>
 <xsl:variable name="car" select="substring-before($details,';')"/>
 <xsl:variable name="cdr" select="substring-after($details,';')"/>
 <Order>
  <OrderNumber><xsl:value-of select="substring-before($car,'#')"/></OrderNumber>
  <Ammount><xsl:value-of select="substring-after($car,'#')"/></Ammount>
 </Order>
 <xsl:if test="contains($cdr,'#')">
  <xsl:apply-templates select=".">
   <xsl:with-param name="details" select="$cdr"/>
  </xsl:apply-templates>
 </xsl:if>
</xsl:template>


</xsl:stylesheet>


$ saxon9 pay.xml pay.xsl
<?xml version="1.0" encoding="UTF-8"?>
<Orders>
   <Order>
      <OrderNumber>order1</OrderNumber>
      <Ammount>amt1</Ammount>
   </Order>
   <Order>
      <OrderNumber>order2</OrderNumber>
      <Ammount>amt2</Ammount>
   </Order>
</Orders>


XSL-List info and archive <http://www.mulberrytech.com/xsl/xsl-list>
EasyUnsubscribe <http://lists.mulberrytech.com/unsub/xsl-list/2837134> (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>