3 Replies Latest reply on Jul 11, 2013 8:47 AM by Ranganath Samudrala

    XSLT : select an element when it exists

    Olivier Lasis
      Share This:

      Hi big experts,

      I have a little problem.

      I want to select the element row in the result of an sql query when it exists.

       

      Here are sample of "adapter response" :

      <sqlAdapterResponse>
        <metadata>
          <queryExecuted>select ip,hostname from afa_vlan_0010 where hostname = '_TSTTMCMIDL2'</queryExecuted>
          <execution-milliseconds>47</execution-milliseconds>
          <responseRowCount>0</responseRowCount>
          <responseColumnCount>2</responseColumnCount>
          <status>success</status>
        </metadata>
      </sqlAdapterResponse>

       

      <sqlAdapterResponse>
        <row>
          <column name="ip" label="ip">172.23.204.14</column>
          <column name="hostname" label="hostname">_TSTTMCMIDL2</column>
        </row>
        <metadata>
          <queryExecuted>select ip,hostname from tmc_vlan_0274 where hostname = '_TSTTMCMIDL2'</queryExecuted>
          <execution-milliseconds>32</execution-milliseconds>
          <responseRowCount>1</responseRowCount>
          <responseColumnCount>2</responseColumnCount>
          <status>success</status>
        </metadata>
      </sqlAdapterResponse>

       

      I am lost.

      Which XSLT or Xpath command, I should use in order to make a copy of the element colum with name = "ip" ?

       

      Best regards.

      Olivier.