?
Solved

Edit stylesheet to remove some data outputs

Posted on 2008-11-10
17
Medium Priority
?
267 Views
Last Modified: 2013-11-18
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
0
Comment
Question by:DiCanio13
  • 7
  • 4
  • 2
  • +1
14 Comments
 
LVL 15

Expert Comment

by:SRigney
ID: 22932508
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
 
LVL 60

Expert Comment

by:Geert Bormans
ID: 22932538
<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
 
LVL 15

Expert Comment

by:SRigney
ID: 22932648
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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 

Author Comment

by:DiCanio13
ID: 22935898
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
 
LVL 60

Expert Comment

by:Geert Bormans
ID: 22937563
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
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 22937921
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
 
LVL 60

Expert Comment

by:Geert Bormans
ID: 22938040
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
 

Author Comment

by:DiCanio13
ID: 22945712
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
 
LVL 60

Expert Comment

by:Geert Bormans
ID: 22967839
I have changed your PSelection XSLT.
Is this what you want?
PSelection-xsl.txt
0
 

Author Comment

by:DiCanio13
ID: 22972311
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
 
LVL 60

Expert Comment

by:Geert Bormans
ID: 22979003
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
 
LVL 60

Accepted Solution

by:
Geert Bormans earned 1000 total points
ID: 22979043
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
 

Author Comment

by:DiCanio13
ID: 22980558
Thanks Gertone, this solution works perfectly!
0
 
LVL 60

Expert Comment

by:Geert Bormans
ID: 22982601
welcome
0

Featured Post

Become an Android App Developer

Ready to kick start your career in 2018? Learn how to build an Android app in January’s Course of the Month and open the door to new opportunities.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Browsers only know CSS so your awesome SASS code needs to be translated into normal CSS. Here I'll try to explain what you should aim for in order to take full advantage of SASS.
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
In this tutorial viewers will learn how to style elements, such a divs, with a "drop shadow" effect using the CSS box-shadow property Start with a normal styled element, such as a div.: In the element's style, type the box shadow property: "box-shad…
In this tutorial viewers will learn how to style a decorative dropcap for the first letter in a paragraph using CSS. In CSS, create a new paragraph class by typing "p.fancy": Then, to style only the first letter of the first sentence, include the ps…
Suggested Courses

615 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question