Jump to content

Exclude "unfiltered" HTML lines


Recommended Posts

Hello W3 people,

i have a newbie question. I have got a small script from a colleague to further develop. I know how to program but XSL I do not understand quite well. The scripts brain i inside VBA and several XSL files shall be used to "prefilter" certain documents. The idea behind this is that the VBA code does not need to be adapted and only the XSL "filter" needs to be adapted. The problem ist that i do not understand the hidden magic of XSL :D This is one of the XSL files which does not work like i want:

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:strip-space elements="*"/>
<xsl:output method="xml" indent="yes"/>

    <xsl:template match="/">
  <!-- add needed HEADINGS from your report which contains assesslets you need here-->
   <xsl:for-each select="//div[h2='2.3 Assesslet Summary (No Variables included)']/div/table">
  <xsl:apply-templates select="."/> 

    <xsl:template match="table">
   <!-- Carefully check the structure underneath the HEADINGS and adapt here -->
  <xsl:for-each select="//td[@class='passed' or @class ='failed']/span">
  <xsl:apply-templates select="."/>

    <xsl:template match="span">
  <xsl:value-of select="."/>


What shall this do:

-I know that all elements i need are under the h2 heading "'2.3 Assesslet Summary (No Variables included)". So i choose this heading and apply a new template.

-As a next step i know that there is one table underneath this h2 heading which has certain elements which have the class "passed" or "failed". I choose them and apply a new template.

-The last step is collecting all the spans

The Output is the following:

-I get all elements i want and additionally all other elements which should be excluded by the top two templates. I think the solution would be to exclude "unfiltered" elements. Can somebody tell me how to do this? I hope you understand.


Thank you.


Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...