xml - XSL1.0 - Apply-templates only takes the first child node -
i'm working on new addition report dip-sensor data. i'm running problem apply-templates checks first <filter> node , not rest.
i have tried changing code use for-each instead of apply-templates, still no luck.
xml file:
... </dlp-sensor> <dlp-sensor> <name>dlpsensor.1</name> <description/> <property>0</property> <filter-list> <filter> <enabled>true</enabled> <source> <type>6</type> <any/> </source> <destination> <type>6</type> <any/> </destination> <dlp-action> <smtp-action>lock</smtp-action> <action>drop</action> <log>1</log> <alarm>0</alarm> </dlp-action> </filter> <filter> <enabled>true</enabled> <source> <type>3</type> <email-addr>blah@uneducated.edu</email-addr> </source> <destination> <type>1</type> <host-ip-addr>192.1.1.1</host-ip-addr> </destination> <dlp-action> <smtp-action>block</smtp-action> <action>drop</action> <log>1</log> <alarm>dlp</alarm> </dlp-action> </filter> <filter> <enabled>true</enabled> <source> <type>4</type> <auth-user>ninja-hacker</auth-user> </source> <destination> <type>3</type> <email-addr>ceo@companyowner.edu</email-addr> </destination> <dlp-action> <smtp-action>strip</smtp-action> <action>block</action> <log>0</log> <alarm>0</alarm> </dlp-action> </filter> </filter-list> </dlp-sensor> <dlp-sensor> ... xsl v1.0:
<xsl:template match="dlp-sensor" mode="dlpdetails"> <table> <tr> <th class="second_head"><xsl:call-template name="getresource"><xsl:with-param name="resid" select="'source'"/></xsl:call-template></th> <th class="second_head"><xsl:call-template name="getresource"><xsl:with-param name="resid" select="'destination'"/></xsl:call-template></th> </tr> <xsl:apply-templates select="filter-list/filter" mode="filtering"/> </table> </xsl:template> <xsl:template match="filter" mode="filtering"> <tr> <td> <xsl:value-of select="source/type"/> </td> <td> <xsl:value-of select="destination/type"/> </td> </tr> </xsl:template> result: 66
desired: 663143
the results show 66 should show 663143 because should have captured source/type , destination/type 3 <filter> nodes in <filter-list>.
there can amount of <dlp-sensor> , each might have different amount of <filter>. doing wrong?
you have spelling error:
<xsl:apply-templates select="filter-list/filter" mode="filtering"/>
also perhaps try <xsl:for-each select="dlp-sensor/filter-list"> followed <**xsl:apply-templates** select="filter">
Comments
Post a Comment