[XSL-LIST Mailing List Archive Home] [By Thread] [By Date]

Re: [xsl] Creating new, distinct groups of ranges from an aggregation of individual ranges

Subject: Re: [xsl] Creating new, distinct groups of ranges from an aggregation of individual ranges
From: "Imsieke, Gerrit, le-tex gerrit.imsieke@xxxxxxxxx" <xsl-list-service@xxxxxxxxxxxxxxxxxxxxxx>
Date: Tue, 18 Nov 2014 23:38:13 -0000

On 18.11.2014 23:53, Michael Friedman sumarimike@xxxxxxxxxxx wrote:

Note: My first reply email was too long and was rejected by the system.
I hope this one is shorter. I removed the output, but it can be
reproduced using the below.

Wow - great suggestions and assistance. Heiko, your solution is very
promising and is one I started testing. To answer your question, the gap
you identified should be missing. These new ranges only show what SHOULD
be output in the final XSLFO, so the gaps need to be omitted. Great catch.

If I process your input, the difference between filling these gaps and not filling these gaps will be this:

with gaps filled:
<range start="218" end="218"/>
<range start="219" end="219"/>
<range start="220" end="222"/>

without gaps filled:
<range start="218" end="218"/>
<range start="220" end="222"/>

I think the 219 stems from input token 02010222.
So Ibd think that it should be included, shouldnbt it?

Ibm sorry that I am stubbornly pursuing my own code, but here it is:


<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"

<xsl:import href="ranges.xsl"/>

  <xsl:template match="group[aircraft-range]">
    <xsl:variable name="parse" as="element(ranges)">
        <xsl:apply-templates mode="parse"/>
    <xsl:apply-templates select="$parse"/>

<xsl:template match="aircraft-range" mode="parse">
<xsl:for-each select="tokenize(., '\s+')">
<xsl:analyze-string select="." regex="^(\d{{4}})(\d{{4}})?$">
<range start="{number(regex-group(1))}" end="{number((regex-group(2)[normalize-space()], regex-group(1))[1])}"/>
<xsl:message select="'Could not parse ', ."/>


ranges.xsl is almost the same as what I posted recently, with <xsl:template match="/ranges"> changed to <xsl:template match="ranges">

Pass3 output:

      <range start="201" end="204"/>
      <range start="205" end="205"/>
      <range start="206" end="207"/>
      <range start="208" end="210"/>
      <range start="211" end="212"/>
      <range start="213" end="213"/>
      <range start="214" end="217"/>
      <range start="218" end="218"/>
      <range start="219" end="219"/>
      <range start="220" end="222"/>
      <range start="225" end="226"/>
      <range start="228" end="228"/>
      <range start="232" end="232"/>
      <range start="235" end="235"/>
      <range start="236" end="238"/>
      <range start="239" end="239"/>
      <range start="240" end="240"/>
      <range start="251" end="252"/>
      <range start="257" end="261"/>
      <range start="262" end="263"/>
      <range start="264" end="266"/>
      <range start="267" end="269"/>
      <range start="270" end="285"/>
      <range start="286" end="287"/>
      <range start="290" end="290"/>
      <range start="292" end="292"/>
      <range start="296" end="296"/>
      <range start="401" end="405"/>
      <range start="408" end="408"/>
      <range start="411" end="411"/>
      <range start="415" end="416"/>
      <range start="451" end="452"/>
      <range start="453" end="453"/>
      <range start="454" end="455"/>
      <range start="456" end="460"/>


Current Thread