0
votes

Complete noob here, need to edit some XML code for work.

I need to remove the "Value for" and "Range for" rows where the number beings with the digit 8, what would be the best way of going about this? Any help would be appreciated!

Cheers

The Code

?xml version="1.0" encoding="UTF-8" ?>

        <Theme  xmlns="SOME SITE" id="t59" name="I LOVE TIM TAMS">



            <Indicator id="i564" name="I LOVE TIM TAMS" type="numeric" precision="1"  href="SOME SITE">

                <Value for="80200">53.1</Value>

                <Value for="80420">^</Value>

                <Value for="80540">^</Value>

                <Value for="80620">^</Value>

                <Value for="70700">^</Value>

                <Value for="71000">62.3</Value>

                <Value for="71300">^</Value>

                <Value for="72200">47.9</Value>

                <Value for="72300">63.8</Value>

                <Value for="72330">^</Value>

                <Value for="72800">56.9</Value>

                <Value for="73600">^</Value>

                <Value for="74050">^</Value>

                <Value for="74500">^</Value>

                <Value for="74560">^</Value>

                <Value for="74660">^</Value>

                <Value for="79399">^</Value>

                <ComparisonValue for="1">52.1</ComparisonValue>

                <ComparisonValue for="2">56.3</ComparisonValue>

                <ComparisonValue for="3">43.3</ComparisonValue>

                <ComparisonValue for="4">51.5</ComparisonValue>

                <ComparisonValue for="5">56.0</ComparisonValue>

                <ComparisonValue for="6">43.3</ComparisonValue>

                <ComparisonValue for="7">51.6</ComparisonValue>

                <ComparisonValue for="8">54.8</ComparisonValue>

                <ComparisonValue for="9">41.2</ComparisonValue>

                <ComparisonValue for="10">47.9</ComparisonValue>

                <ComparisonValue for="11">51.7</ComparisonValue>

                <ComparisonValue for="12">44.3</ComparisonValue>

                <ComparisonValue for="13">52.7</ComparisonValue>

                <ComparisonValue for="14">57.4</ComparisonValue>

                <ComparisonValue for="15">33.8</ComparisonValue>

                <ComparisonValue for="16">61.9</ComparisonValue>

                <ComparisonValue for="17">63.6</ComparisonValue>

                <ComparisonValue for="18">54.2</ComparisonValue>

                <ComparisonValue for="19">44.5</ComparisonValue>

                <ComparisonValue for="20">55.1</ComparisonValue>

                <ComparisonValue for="21">36.9</ComparisonValue>

                <ComparisonValue for="22">59.3</ComparisonValue>

                <ComparisonValue for="23">61.3</ComparisonValue>

                <ComparisonValue for="24">51.7</ComparisonValue>

                <ComparisonValue for="25">59.5</ComparisonValue>

                <ComparisonValue for="26">59.5</ComparisonValue>

                <ComparisonValue for="27">..</ComparisonValue>

                <Limits>

                    <Range for="80200" upper="59.7" lower="46.6" />

                    <Range for="80420" upper="NaN" lower="NaN" />

                    <Range for="80540" upper="NaN" lower="NaN" />

                    <Range for="80620" upper="NaN" lower="NaN" />

                    <Range for="70700" upper="NaN" lower="NaN" />

                    <Range for="71000" upper="66.9" lower="57.7" />

                    <Range for="71300" upper="NaN" lower="NaN" />

                    <Range for="72200" upper="60.6" lower="35.3" />

                    <Range for="72300" upper="72.5" lower="55.2" />

                    <Range for="72330" upper="NaN" lower="NaN" />

                    <Range for="72800" upper="63.1" lower="50.6" />

                    <Range for="73600" upper="NaN" lower="NaN" />

                    <Range for="74050" upper="NaN" lower="NaN" />

                    <Range for="74500" upper="NaN" lower="NaN" />

                    <Range for="74560" upper="NaN" lower="NaN" />

                    <Range for="74660" upper="NaN" lower="NaN" />

                    <Range for="79399" upper="NaN" lower="NaN" />

                    <Range for="1" upper="52.4" lower="51.7" />

                    <Range for="2" upper="56.7" lower="55.8" />

                    <Range for="3" upper="43.8" lower="42.7" />

                    <Range for="4" upper="52.1" lower="50.9" />

                    <Range for="5" upper="56.8" lower="55.2" />

                    <Range for="6" upper="44.1" lower="42.4" />

                    <Range for="7" upper="52.3" lower="50.9" />

                    <Range for="8" upper="55.6" lower="53.9" />

                    <Range for="9" upper="42.5" lower="39.9" />

                    <Range for="10" upper="48.6" lower="47.2" />

                    <Range for="11" upper="52.7" lower="50.7" />

                    <Range for="12" upper="45.3" lower="43.3" />

                    <Range for="13" upper="53.8" lower="51.5" />

                    <Range for="14" upper="58.7" lower="56.1" />

                    <Range for="15" upper="35.9" lower="31.7" />

                    <Range for="16" upper="62.9" lower="60.9" />

                    <Range for="17" upper="64.8" lower="62.5" />

                    <Range for="18" upper="56.2" lower="52.3" />

                    <Range for="19" upper="45.9" lower="43.1" />

                    <Range for="20" upper="57.3" lower="52.8" />

                    <Range for="21" upper="38.7" lower="35.1" />

                    <Range for="22" upper="62.3" lower="56.3" />

                    <Range for="23" upper="64.7" lower="57.9" />

                    <Range for="24" upper="57.6" lower="45.8" />

                    <Range for="25" upper="61.4" lower="57.7" />

                    <Range for="26" upper="61.4" lower="57.7" />

                    <Range for="27" upper="NaN" lower="NaN" />

                </Limits>

                <Associate name="NUMBER" type="numeric"  precision="0"  >

                    <Value for="80200">10651</Value>

                    <Value for="80420">^</Value>

                    <Value for="80540">^</Value>

                    <Value for="80620">^</Value>

                    <Value for="70700">^</Value>

                    <Value for="71000">38483</Value>

                    <Value for="71300">^</Value>

                    <Value for="72200">3607</Value>

                    <Value for="72300">11182</Value>

                    <Value for="72330">^</Value>

                    <Value for="72800">13265</Value>

                    <Value for="73600">^</Value>

                    <Value for="74050">^</Value>

                    <Value for="74500">^</Value>

                    <Value for="74560">^</Value>

                    <Value for="74660">^</Value>

                    <Value for="79399">^</Value>

                    <ComparisonValue for="1">9214658</ComparisonValue>

                    <ComparisonValue for="2">6738633</ComparisonValue>

                    <ComparisonValue for="3">2471615</ComparisonValue>

                    <ComparisonValue for="4">2961214</ComparisonValue>

                    <ComparisonValue for="5">2087722</ComparisonValue>

                    <ComparisonValue for="6">873492</ComparisonValue>

                    <ComparisonValue for="7">2312577</ComparisonValue>

                    <ComparisonValue for="8">1885964</ComparisonValue>

                    <ComparisonValue for="9">426613</ComparisonValue>

                    <ComparisonValue for="10">1665325</ComparisonValue>

                    <ComparisonValue for="11">872238</ComparisonValue>

                    <ComparisonValue for="12">793087</ComparisonValue>

                    <ComparisonValue for="13">677071</ComparisonValue>

                    <ComparisonValue for="14">589665</ComparisonValue>

                    <ComparisonValue for="15">87406</ComparisonValue>

                    <ComparisonValue for="16">1166801</ComparisonValue>

                    <ComparisonValue for="17">974713</ComparisonValue>

                    <ComparisonValue for="18">192088</ComparisonValue>

                    <ComparisonValue for="19">176365</ComparisonValue>

                    <ComparisonValue for="20">91703</ComparisonValue>

                    <ComparisonValue for="21">84662</ComparisonValue>

                    <ComparisonValue for="22">77628</ComparisonValue>

                    <ComparisonValue for="23">63361</ComparisonValue>

                    <ComparisonValue for="24">14267</ComparisonValue>

                    <ComparisonValue for="25">173267</ComparisonValue>

                    <ComparisonValue for="26">173267</ComparisonValue>

                    <ComparisonValue for="27">..</ComparisonValue>

                </Associate>

                <Associate name="THE ONE" type="numeric"  >

                    <Value for="80200">reliable</Value>

                    <Value for="80420">..</Value>

                    <Value for="80540">..</Value>

                    <Value for="80620">..</Value>

                    <Value for="70700">..</Value>

                    <Value for="71000">reliable</Value>

                    <Value for="71300">..</Value>

                    <Value for="72200">reliable</Value>

                    <Value for="72300">reliable</Value>

                    <Value for="72330">..</Value>

                    <Value for="72800">reliable</Value>

                    <Value for="73600">..</Value>

                    <Value for="74050">..</Value>

                    <Value for="74500">..</Value>

                    <Value for="74560">..</Value>

                    <Value for="74660">..</Value>

                    <Value for="79399">..</Value>

                    <ComparisonValue for="1">reliable</ComparisonValue>

                    <ComparisonValue for="2">reliable</ComparisonValue>

                    <ComparisonValue for="3">reliable</ComparisonValue>

                    <ComparisonValue for="4">reliable</ComparisonValue>

                    <ComparisonValue for="5">reliable</ComparisonValue>

                    <ComparisonValue for="6">reliable</ComparisonValue>

                    <ComparisonValue for="7">reliable</ComparisonValue>

                    <ComparisonValue for="8">reliable</ComparisonValue>

                    <ComparisonValue for="9">reliable</ComparisonValue>

                    <ComparisonValue for="10">reliable</ComparisonValue>

                    <ComparisonValue for="11">reliable</ComparisonValue>

                    <ComparisonValue for="12">reliable</ComparisonValue>

                    <ComparisonValue for="13">reliable</ComparisonValue>

                    <ComparisonValue for="14">reliable</ComparisonValue>

                    <ComparisonValue for="15">reliable</ComparisonValue>

                    <ComparisonValue for="16">reliable</ComparisonValue>

                    <ComparisonValue for="17">reliable</ComparisonValue>

                    <ComparisonValue for="18">reliable</ComparisonValue>

                    <ComparisonValue for="19">reliable</ComparisonValue>

                    <ComparisonValue for="20">reliable</ComparisonValue>

                    <ComparisonValue for="21">reliable</ComparisonValue>

                    <ComparisonValue for="22">reliable</ComparisonValue>

                    <ComparisonValue for="23">reliable</ComparisonValue>

                    <ComparisonValue for="24">reliable</ComparisonValue>

                    <ComparisonValue for="25">reliable</ComparisonValue>

                    <ComparisonValue for="26">reliable</ComparisonValue>

                    <ComparisonValue for="27">..</ComparisonValue>

                </Associate>                    <Property name="alias_indicator" value="CHOCOLATE"/>

                <Property name="metatext" value="Note: THEY TASTE YUMMY"/>

                <Property name="precision" value="1"/>



            </Indicator></Theme>
1

1 Answers

0
votes

Here's an XSLT 3.0 stylesheet (use for example with Saxon 9.8):

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

  <xsl:mode on-no-match="shallow-copy"/>

  <xsl:template match="(Value|Range)[starts-with(@for, '8')]"/>

</xsl:stylesheet>

It can also be done with XSLT 1.0 or 2.0 but the code gets more verbose.