Edit stylesheet to remove some data outputs

Hi,

Ive currently got an application that outputs a results document. This document contains alot of detail, so much so that it has too much detail. The document is built up row by row by steps performed during the aapplications execution. Specifically i would like to NOT include any details about steps that have a status of 'passed', 'warning', etc. I would only like to include steps that include a status of 'failed'. Ive attached the xml format and the current stylesheet. If we could change the below code to choose only failed steps, that might work?

<xsl:choose>
       <xsl:when test="child::*[position() = 2 and name() = 'Step']" >
             <tr>
                      <td class="table_hl" width="20%"><xsl:copy-of select="$IDS_NAME"/></td>
      <td class="table_hl" width="10%"><xsl:copy-of select="$IDS_STATUS"/></td>
      <td class="table_hl" width="10%"><xsl:copy-of select="$IDS_TIME"/></td>
      <td class="table_hl" width="60%"><xsl:copy-of select="$IDS_DETAILS"/></td>
            </tr>      
       </xsl:when>
       <xsl:otherwise>  </xsl:otherwise>
</xsl:choose>
Results.txt
current-xsl-stylesheet.txt
DiCanio13Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

SRigneyCommented:
One thing you could do is create a class for each status that will show or hide the information.

<xsl:choose>
       <xsl:when test="child::*[position() = 2 and name() = 'Step']" >
             <tr class='<xsl:copy-of select="$IDS_STATUS"/>'>
                      <td class="table_hl" width="20%"><xsl:copy-of select="$IDS_NAME"/></td>
      <td class="table_hl" width="10%"><xsl:copy-of select="$IDS_STATUS"/></td>
      <td class="table_hl" width="10%"><xsl:copy-of select="$IDS_TIME"/></td>
      <td class="table_hl" width="60%"><xsl:copy-of select="$IDS_DETAILS"/></td>
            </tr>      
       </xsl:when>
       <xsl:otherwise>  </xsl:otherwise>
</xsl:choose>


Then in your CSS you could have
.passed, .warning {
  display: hidden;
}
0
Geert BormansInformation ArchitectCommented:
<tr class='<xsl:copy-of select="$IDS_STATUS"/>'>
this my friend will not work,
you can't have xsl elements in attribute values,
I think you mean this
<tr class='{$IDS_STATUS}'>
but your idea might actually work

also note that this is a duplicate question
it is the same as this one
http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/XSLT/Q_23880404.html
0
SRigneyCommented:
Thanks Gertone.  I was not sure about the xsl in the attribute.   I normally would use c:out in that situation, but have not had xsl data that I was dealing with at the time.
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

DiCanio13Author Commented:
Hi guys,
Thanks for the help but this still doesnt work. What's happening now is that when the rows (steps) are being added the action, status, time and details are being added for all steps, but when the status is something other than 'failed' it just outputs blank. For example the 'passed' row step, time and details still get outputted but with a blank status.
If possible id like the entire row (step, status, time and details) of only steps of status 'failed'. Do you think this is possible?
0
Geert BormansInformation ArchitectCommented:
As I already asked in your (exactly the same, by the way) other question...
You have posted the XSLT, but not all the imported and included XSLT components
Two comments...
1. I can only debug an XSLT this complex if I have all the components, so I can test
2. It is not appropriate to leave an experts comment unanswered and simply repost the question... please follow up
0
Michel PlungjanIT ExpertCommented:
Gertone: how to change
<xsl:choose>
       <xsl:when test="child::*[position() = 2 and name() = 'Step']" >
             <tr class='<xsl:copy-of select="$IDS_STATUS"/>'>
                      <td class="table_hl" width="20%"><xsl:copy-of select="$IDS_NAME"/></td>
      <td class="table_hl" width="10%"><xsl:copy-of select="$IDS_STATUS"/></td>
      <td class="table_hl" width="10%"><xsl:copy-of select="$IDS_TIME"/></td>
      <td class="table_hl" width="60%"><xsl:copy-of select="$IDS_DETAILS"/></td>
            </tr>      
       </xsl:when>
       <xsl:otherwise>  </xsl:otherwise>
</xsl:choose>

to

<xsl:if  test="child::*[position() = 2 and name() = 'Step'] and $IDS_STATUS= ''failed'" >
  <tr>
    <td class="table_hl" width="20%"><xsl:copy-of select="$IDS_NAME"/></td>
    <td class="table_hl" width="10%"><xsl:copy-of select="$IDS_STATUS"/></td>
    <td class="table_hl" width="10%"><xsl:copy-of select="$IDS_TIME"/></td>
    <td class="table_hl" width="60%"><xsl:copy-of select="$IDS_DETAILS"/></td>
  </tr>      
</xsl:if>

in a correct syntax.

I believe this is what he wants
0
Geert BormansInformation ArchitectCommented:
Hi Michel,
it seems that you are very close, you just had one too many '
I feel a bit uncomfortable in that I don't see where the variables are created, it is in the included stylesheet likely
but this might as well work
cheers
Geert


    <xsl:if  test="child::*[position() = 2 and name() = 'Step'] and $IDS_STATUS= 'failed'" >
        <tr>
            <td class="table_hl" width="10%"><xsl:copy-of select="$IDS_STATUS"/></td>
        </tr>      
    </xsl:if>

Open in new window

0
DiCanio13Author Commented:
Hi guys,

Thanks for your help, but it now gives a runtime error. Ive attached as much information as i could below. Hopefully you have enough information to solve this problem. Ive added the below attachments as text files and put in brackets the real file extension.
I really appreciate your help with this
PResults-css-.txt
PSelection-xsl-.txt
PShort-xsl-.txt
PStringTable-xsl-.txt
Results-css-.txt
Results-xml-.txt
QuickTest-Professional-Report.doc
0
Geert BormansInformation ArchitectCommented:
I have changed your PSelection XSLT.
Is this what you want?
PSelection-xsl.txt
0
DiCanio13Author Commented:
Hi Gertone,

Unfortunately, this doesnt seem to have fixed the issue. Im not sure what you changed in the PSelection file but the results still seem to output the same as previous. The entire row of data that includes a status of either 'passed', 'warning' or 'done' still gets added to the results, when i would like only rows of data that include a status of 'failed' to be included.
0
Geert BormansInformation ArchitectCommented:
My friend,
I have been working in the wrong stylesheet.
It is Pshort.xsl that you would want to change

In line 68 you have
<xsl:template match="Step|HtmlStep">
Make that line into this
      <xsl:template match="Step[not(NodeArgs/@status = 'Failed')]|HtmlStep[not(NodeArgs/@status = 'Failed')]"/>
      <xsl:template match="Step[NodeArgs/@status = 'Failed']|HtmlStep[NodeArgs/@status = 'Failed']">
And you will end up with only a list of actions and the one line of failure
0
Geert BormansInformation ArchitectCommented:
If you want just the heading of the actions that have a failed NodeArgs

you will want to change line 141
<xsl:template match="Action">

into
      <xsl:template match="Action[not(.//NodeArgs/@status = 'Failed')]"/>
      <xsl:template match="Action[.//NodeArgs/@status = 'Failed']">

If you want to see the entire detail of an Action that has a Failed NodeArgs, then undo the change of my previous message

I hope that this will now work as you wanted it
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
DiCanio13Author Commented:
Thanks Gertone, this solution works perfectly!
0
Geert BormansInformation ArchitectCommented:
welcome
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Languages and Standards

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.