Topic
  • 1 reply
  • Latest Post - ‏2012-06-07T12:02:24Z by UserSpanish
UserSpanish
UserSpanish
21 Posts

Pinned topic XSLT Transformation, problem

‏2012-06-07T08:09:02Z |
Hi,

I have a XML message where I have a list, I want to erase the duplicates,, I'm trying to use "set:distinct", but it doesn't work or I don't know how I use it. Could someone give a clue??

Thanks.
This is the XML:

<?xml version="1.0" encoding="UTF-8"?>
<ns0:KeepAlivePSSPRequest xmlns:ns0="http://ADIF_ObjetosDeNegocio/WSDL/KeepAlivePSSP">
<Request>
<BosyMsgCDM>
<listaDispositivos>
<listaDispositivos>
<idSCADA>11</idSCADA>
<idDispositivo>A</idDispositivo>
</listaDispositivos>
<listaDispositivos>
<idSCADA>22</idSCADA>
<idDispositivo>ABC</idDispositivo>
</listaDispositivos>
<listaDispositivos>
<idSCADA>11</idSCADA>
<idDispositivo>CCCC</idDispositivo>
</listaDispositivos>
</listaDispositivos>
</BosyMsgCDM>

I want to get: (So, I only want to keep one element for each IdSCADA)

<Request>
<BosyMsgCDM>
<listaDispositivos>
<listaDispositivos>
<idSCADA>11</idSCADA>
<idDispositivo>A</idDispositivo>
</listaDispositivos>
<listaDispositivos>
<idSCADA>22</idSCADA>
<idDispositivo>ABC</idDispositivo>
</listaDispositivos>
</listaDispositivos>
</BosyMsgCDM>
I'm using: (but, I only get a empty list..)
<mappingDeclaration name="XSLQuitarRepeticiones_req_1">
<input namespace="http://www.ibm.com/websphere/sibx/smo/v6.0.1" path="smo"/>
<output namespace="http://www.ibm.com/websphere/sibx/smo/v6.0.1" path="smo"/>
<foreach>
<input path="body/KeepAlivePSSPRequest/Request/BosyMsgCDM/listaDispositivos/listaDispositivos" var="listaDispositivos"/>
<output path="body/KeepAlivePSSPRequest/Request/BosyMsgCDM/listaDispositivos/listaDispositivos"/>
<filter lang="XPath">set:distinct($listaDispositivos/idSCADA)</filter>
<move>
<input path="$listaDispositivos/." var="listaDispositivos1"/>
<output path="."/>
</move>
</foreach>
</mappingDeclaration>
Thank you!.
Updated on 2012-06-07T12:02:24Z at 2012-06-07T12:02:24Z by UserSpanish
  • UserSpanish
    UserSpanish
    21 Posts

    Re: XSLT Transformation, problem

    ‏2012-06-07T12:02:24Z  
    I'd like to do something seems to this example (http://www.ibm.com/developerworks/websphere/library/techarticles/1003_spriet2/1003_spriet2.html *Figure 12. Filtering using XPath expressions*), but, I want to erase all the duplicates.

    The only thing that I got, it's to eliminate the nodes what are identical, but, I only want to check a field.