I'm working on this new addition to report dip-sensor
data. But I'm running into a problem where apply-templates
only checks for the first <filter>
node and not the rest.
I also have tried changing the code to use a for-each
instead of apply-templates
, but 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 only show 66
but should show 663143
because it should have captured all the source/type
and destination/type
from all three <filter>
nodes in the <filter-list>
.
There can be any amount of <dlp-sensor>
and each might have a different amount of <filter>
. What am I doing wrong?
You do have a spelling error:
<xsl:apply-templates select="filter-list/filter" mode="filtering"/>
also perhaps try something like
<xsl:for-each select="dlp-sensor/filter-list">
followed with <**xsl:apply-templates** select="filter">