Skip to Content
0
Jan 16, 2018 at 09:07 AM

XSLT/XML debug

207 Views

Hi,

Using XSLT_TOOL to debug XSLT/XML processing, I cant figure out why the node <LOB><VALUE) wont get any data from the XML doc. I'm able to populate data into the <detail> node.

<?xml version="1.0" encoding="UTF-8"?>
<measure xmlns="http://xxxxx.xxxxxx.com/types">
  <quality realtime="1" bad="0"/>
  <ts>2014-11-24T15:18:09.533000+01:00</ts>
  <pbs  native="my-native-code">My Native Code</pbs>
  <sign code="JB" prog="05"/>
  <sender>Test</sender>
  <lob>
    <detail samp="120000" unit="Km" min="0" max="999999"/>
    <value>11.000000</value>
    <value>12.000000</value>
    <value>13.000000</value>
    <value>14.000000</value>
    <value>15.500000</value>
    <value>16.000000</value>
    <value>17.000000</value>
    <value>20.000000</value>
    <value>21.000000</value>
    <value>22.000000</value>
  </lob>
</measure>

XSLT schema looks like this:

<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:zz="http://commons.ansaldo-sts.com/types" version="1.0">
  <xsl:output encoding="iso-8859-1" indent="yes" method="xml" version="1.0"/>
  <xsl:strip-space elements="*"/>

  <xsl:template match="/">
    <asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
      <asx:values>
        <IMEASURE>
          <xsl:apply-templates select="/zz:measure"/>
        </IMEASURE>
      </asx:values>
    </asx:abap>
  </xsl:template>

  <xsl:template match="/zz:measure">
    <item>
      <QUALITY_BAD>
        <xsl:value-of select="zz:quality/@bad"/>
      </QUALITY_BAD>
      <QUALITY_REALTIME>
        <xsl:value-of select="zz:quality/@realtime"/>
      </QUALITY_REALTIME>
      <TS>
        <xsl:value-of select="zz:ts"/>
      </TS>
      <NATIVE>
        <xsl:value-of select="zz:pbs/@native"/>
      </NATIVE>
      <AREA>
        <xsl:value-of select="zz:pbs/@a1"/>
      </AREA>
      <LOCATION_A2>
        <xsl:value-of select="zz:pbs/@a2"/>
      </LOCATION_A2>
      <LOCATION_A3>
        <xsl:value-of select="zz:pbs/@a3"/>
      </LOCATION_A3>
      <LOCATION_A4>
        <xsl:value-of select="zz:pbs/@a4"/>
      </LOCATION_A4>
      <SYSTEM_T>
        <xsl:value-of select="zz:pbs/@t"/>
      </SYSTEM_T>
      <SYSTEM_S>
        <xsl:value-of select="zz:pbs/@s"/>
      </SYSTEM_S>
      <FUNCTION>
        <xsl:value-of select="zz:pbs/@r"/>
      </FUNCTION>
      <SIGN_PROG>
        <xsl:value-of select="zz:sign/@prog"/>
      </SIGN_PROG>
      <SIGN_CODE>
        <xsl:value-of select="zz:sign/@code"/>
      </SIGN_CODE>
      <SENDER>
        <xsl:value-of select="zz:sender"/>
      </SENDER>
      <MOBILE_TID>
        <xsl:value-of select="zz:mobile/@tid"/>
      </MOBILE_TID>
      <MOBILE_CB>
        <xsl:value-of select="zz:mobile/@cb"/>
      </MOBILE_CB>
      <MOBILE_DID>
        <xsl:value-of select="zz:mobile/@did"/>
      </MOBILE_DID>
      <PROP_AUTOGEN>
        <xsl:value-of select="zz:property/@autogen"/>
      </PROP_AUTOGEN>
      <PROP_INTERNAL>
        <xsl:value-of select="zz:property/@internal"/>
      </PROP_INTERNAL>
      <PROP_PRIO>
        <xsl:value-of select="zz:property/@prio"/>
      </PROP_PRIO>

      <LOB>
        <xsl:for-each select="zz:lob">
          <item>

            <DETAIL>
              <xsl:for-each select="zz:detail">
                <item>
                  <OFS>
                    <xsl:value-of select="@ofs"/>
                  </OFS>
                  <SAMP>
                    <xsl:value-of select="@samp"/>
                  </SAMP>
                  <UNIT>
                    <xsl:value-of select="@unit"/>
                  </UNIT>
                  <MIN>
                    <xsl:value-of select="@min"/>
                  </MIN>
                  <MAX>
                    <xsl:value-of select="@max"/>
                  </MAX>
                </item>
              </xsl:for-each>
            </DETAIL>

            <SIGN>
              <xsl:for-each select="zz:sign">
                <item>
                  <NAME>
                    <xsl:for-each select="zz:name">
                      <item>
                        <LANG>
                          <xsl:value-of select="@lang"/>
                        </LANG>
                        <VALUE>
                          <xsl:value-of select="@value"/>
                        </VALUE>
                      </item>
                    </xsl:for-each>
                  </NAME>
                </item>
              </xsl:for-each>
            </SIGN>

            <PBS>
              <xsl:for-each select="zz:pbs">
                <item>
                  <NAME>
                    <xsl:for-each select="zz:name">
                      <item>
                        <LANG>
                          <xsl:value-of select="@lang"/>
                        </LANG>
                        <VALUE>
                          <xsl:value-of select="@value"/>
                        </VALUE>
                      </item>
                    </xsl:for-each>
                  </NAME>
                </item>
              </xsl:for-each>
            </PBS>

            <BP>
              <xsl:for-each select="zz:bp">
                <item>
                  <VALUE>
                    <xsl:value-of select="zz:bp"/>
                  </VALUE>
                </item>
              </xsl:for-each>
            </BP>

           <VALUE>
              <xsl:for-each select="zz:value">
                <item>
                  <VALUE>
                    <xsl:value-of select="zz:value"/>
                  </VALUE>
                </item>
              </xsl:for-each>
           </VALUE>
          </item>
        </xsl:for-each>

      </LOB>
    </item>
  </xsl:template>
</xsl:transform>

I tried to remove the for-each indside <VALUE> but then I only get the first value populated.

<value>11.000000</value>

It is only the <VALUE> node I cant get populated, rest is working correct.