Subject: RE: [xsl] how to Filter the log files From: "Shrivastava, Shrivastava" <shalabh.shrivastava@xxxxxx> Date: Wed, 29 Sep 2004 17:08:40 +0530 |
Hi, I am pasting you the XSL + XML(jtl) files. This is a sample XML file.Actually there might be lot of XMLs. In the XSL I wrote, I want to incorporate a logic through which I can filter out all those XML files in which responseCode is not 0.All the XML files in which the responseCode is 0 ,then xml filename should be written in a text file say textA.txt. All the XML files in which any responseCode is not 0,then xml filename should be written in a text file say textB.txt.This way I have two files textA.txt and textB.txt. textA.txt contains all the log XMLs which have all responseCode=3D0. textB.txt contains all the log XMLs which have at least one responseCode not=3D0. Actually responseCode is the attribute through which we can find whether the log is success one or failure one. My XSL should perform is that- ->It should filter out all the successful logs into one file. -> It should filter out all the failure logs into other file. MoreOver in the XSL code you sent me, can you tell me how to create the file/folder?=20 It would also be nice if we can filter out the HTML files generated through XSL instead of XML logs. Hope you might get what I want to perform :-) Please help me to provide the solution. =============================XSL File===================== <?xml version="1.0" ?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:template match="/"> <html><head><title>Build Acceptance Criteria Result Report</title></head> <body> <!-- *** REsponse Information *** --> <head><center><b><font color="Teal" face="Georgia" size="3">Build Acceptance Criteria Result Report</font></b></center></head> <table style="WIDTH: 1000px;HEIGHT:1000" bgColor="white" border="1"> <tr bgColor="teal"> <td><font face="Georgia" color="white">Status</font></td> <td><font face="Georgia" color="white">Response Code</font></td> <td><font face="Georgia" color="white">Code Description</font></td> <td><font face="Georgia" color="white">Thread Name</font></td> </tr> <xsl:for-each select="testResults/sampleResult"> <tr bgColor="#ffff99"> <td> <xsl:value-of select="@responseMessage"></xsl:value-of> </td> <td> <xsl:value-of select="@responseCode"></xsl:value-of> </td> <td> <xsl:if test="@responseCode='32'"> <xsl:text>Object Does Not Exist</xsl:text> </xsl:if> <xsl:if test="@responseCode='0'"> <xsl:text>Successful Request</xsl:text> </xsl:if> <xsl:if test="@responseCode='68'"> <xsl:text>Object Already Exists.</xsl:text> </xsl:if> </td> <td> <xsl:value-of select="@threadName"></xsl:value-of> </td> </tr> </xsl:for-each> </table> <!-- *** Response Information *** OVER --> </body> </html> </xsl:template> </xsl:stylesheet> ====================================================== =======================XML fileStart======================== <?xml version="1.0" encoding="UTF-8"?> <testResults> <sampleResult timeStamp="1095167662390" dataType="text"threadName="CreateAcc1-1" label="ldap://gudga01-xp-v1:20389/dc=eta:bind:CreateAcc1-1;1095167662359 " time="31" responseMessage="Success" responseCode="0" success="true"/> <sampleResult timeStamp="1095335105484" dataType="text" threadName="CreateAcc1-1" label="ldap://ganka03-vm-2k3:20389/dc=eta:modify:CreateAcc1-1;1095335103 437" time="0" responseMessage=":ETA_E_0008<MAC>, eTrust Access Control Account 'dhiga01' on 'dhiga01-w2k-v0' modification failed: SuperAgent Modify failed: eTrust Access Control: ACC: ACC-LCA ERROR 0x272f: Failed to modify basic properties of ACC user dhiga01 (ERROR: Failed to fetch data for GROUP Profile_1 ) " responseCode="32" success="false"/> </testResults> ================================XML Ends================= Cheers, Shalabh -----Original Message----- From: Jarno.Elovirta@xxxxxxxxx [mailto:Jarno.Elovirta@xxxxxxxxx] Sent: Wednesday, September 29, 2004 4:19 PM To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx Subject: RE: [xsl] how to Filter the log files Hi, <xsl:choose> <xsl:when test="@responsecode = 0"> <!--folder a--> </xsl:when> <xsl:otherwise> <!--folder b--> </xsl:otherwise> </xsl:choose> If that doesn't clarify it at all, you should send us an example source and stylesheet and show us what's the problem spot. (The way you've described your problem makes it a tad hard to know what advice to give you. For example, vanilla XSLT doesn't allow you to define the output stream target in the stylesheet, so I have to assume your using an extension, and your question doesn't really say whether you have problems with conditional processing or dynamically defining the output file path or what.) Cheers, Jarno - VNV Nation: Kingdom (restoration) > -----Original Message----- > From: ext Shrivastava, Shrivastava [mailto:shalabh.shrivastava@xxxxxx] > Sent: 29 September, 2004 13:36 > To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx > Subject: RE: [xsl] how to Filter the log files > > > Hi Jarno, > How can I code in XSL that when I parse the XML logs, for a particular > attribute > if that matches ,the html file created in folder A else in folder B? > > -----Original Message----- > From: Jarno.Elovirta@xxxxxxxxx [mailto:Jarno.Elovirta@xxxxxxxxx] > Sent: Wednesday, September 29, 2004 3:11 PM > To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx > Subject: RE: [xsl] how to Filter the log files > > Hi, > > > Actually I have to parse the XML log files to generate HTML files. > > > > This part has been done succesfully.But now there is a need to > > distinguish the HTML files based on one attribute value. > > > > Each XML file has a attribute called "responsecode".I want > to put all > > the HTML files into one folder which has responsecode=0 > > > > and rest files in another folder which has value other than 0. > > > > How to write this logic in the XSL? > > By using xsl:choose, see > <http://www.w3.org/TR/xslt#section-Conditional-Processing-with > -xsl:choos > e>, and a condition test "@responsecode = 0". > > Cheers, > > Jarno - KiEw: Werkfragment
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: [xsl] how to Filter the log fil, Jarno.Elovirta | Thread | RE: [xsl] how to Filter the log fil, Jarno.Elovirta |
Re: [xsl] Re: [xslt transform & gro, Michael PG | Date | [xsl] xpath (comparing?), Bruce D'Arcus |
Month |