Assignments and counters in XSLT

0

I have the following XML file:

                           

<ascendientes>
    <categoria id="https://datos.madrid.es/egob/kos/entidadesYorganismos">
        <nombre><![CDATA[(no disponible)]]></nombre>
    </categoria>
</ascendientes>

<descendientes>
    <categoria id="https://datos.madrid.es/egob/kos/entidadesYorganismos/Universidades/ColegiosMayores">
        <nombre><![CDATA[Colegios mayores]]></nombre>
        <catSuperior id="https://datos.madrid.es/egob/kos/entidadesYorganismos/Universidades"/>
    </categoria>
    <categoria id="https://datos.madrid.es/egob/kos/entidadesYorganismos/Universidades/EscuelasUniversitarias">
        <nombre><![CDATA[Escuelas universitarias]]></nombre>
        <catSuperior id="https://datos.madrid.es/egob/kos/entidadesYorganismos/Universidades"/>
    </categoria>
    <categoria id="https://datos.madrid.es/egob/kos/entidadesYorganismos/Universidades/Facultades">
       <nombre><![CDATA[Facultades]]></nombre>
        <catSuperior id="https://datos.madrid.es/egob/kos/entidadesYorganismos/Universidades"/>
    </categoria>
    <categoria id="https://datos.madrid.es/egob/kos/entidadesYorganismos/Universidades/OtrosCentrosUniversitarios">
        <nombre><![CDATA[Otros centros universitarios]]></nombre>
        <catSuperior id="https://datos.madrid.es/egob/kos/entidadesYorganismos/Universidades"/>
    </categoria>
</descendientes>

</recurso>
<recurso id="URLRECURSO">
        <idRecurso>6677</idRecurso><categoria>https://datos.madrid.es/egob/kos/entidadesYorganismos/Universidades/OtrosCentrosUniversitarios</categoria>
        <nombre>Escuela Superior de Diseño</nombre>
        <ubicacion>
            <longitud>-3.648827535580886</longitud>
            <latitud>40.40908310416657</latitud>
        </ubicacion>
        <descripcion><Diseño gráfico, Diseño producto, Diseño interiores, Diseño moda, Diseño espacios comerciales, Diseño interactivoMetro: Vinateros (línea 9)  Bus: 71></descripcion>
    </recurso>
    </recursos>

Resource elements there are 156 in the file, I only put 2, the problem I have is that I need to check according to the id attribute of InfoCategoria / descendants / category to which category corresponds each resource, example, in descendants we have, senior colleges, universities, faculties and other centers, because I have to look at each resource element one by one and compare the category element with the id attribute mentioned above and add each one so that in the end I get the total number and that is what I do not I know how to implement.

To count all the resources I use and it works perfectly, it gives 156 what are there but what should I do to get the number of each descendant ?, because I can not use counters in xslt not?

Thank you very much

    
asked by Christian 22.05.2018 в 13:40
source

0 answers