Note that there are some explanatory texts on larger screens.

plurals
  1. POquery regarding xslt and javascript
    primarykey
    data
    text
    <p>i wrote code in xslt to convert xml file to html file. that html file contains tables(approximately 10 tables), and now </p> <p>my requirement is i need to display how many times the words such as "action","trace","verification" occured in the table. i managed to do with the jquery</p> <p>the link for jsfiddle to see my work is: <a href="http://jsfiddle.net/trinathguptha89/s3Ppq/1/" rel="nofollow">http://jsfiddle.net/trinathguptha89/s3Ppq/1/</a></p> <p>i need to know is there any way arround i can do that with either xslt or javascript alone</p> <p>and my xslt code is: </p> <pre><code> &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"&gt; &lt;xsl:template match="Report/Scripts"&gt; &lt;html&gt; &lt;head&gt; &lt;title&gt;Mobiuss.rtp Test Execution Results&lt;/title&gt; &lt;script type="text/javascript" src="jquery.js"&gt;&lt;/script&gt; &lt;style&gt; .sortable {table-layout: fixed; width:100%; height:25px; border:1px solid #ccc; background-color:#8B7D7B} .sortable th {padding:4px 6px 6px; background:#444; color:#fff; text-align:center; color:#ccc} .sortable td {padding:2px 4px 4px; background:#fff; border-bottom:1px solid #ccc;} .sortable tr {text-overflow:scroll} .sortable tr:hover {color:#FFB90F} &lt;/style&gt; &lt;/head&gt; &lt;body&gt; &lt;xsl:for-each select="Script"&gt; &lt;h1&gt;&lt;xsl:value-of select="@File"/&gt;&lt;/h1&gt; Execution log &lt;br&gt; &lt;/br&gt; &lt;div&gt;&lt;/div&gt; &lt;table class="sortable"&gt; &lt;tr&gt; &lt;th&gt;Time&lt;/th&gt; &lt;th&gt;Position&lt;/th&gt; &lt;th&gt;Type&lt;/th&gt; &lt;th&gt;Message&lt;/th&gt; &lt;/tr&gt; &lt;xsl:for-each select="Message"&gt; &lt;tr&gt; &lt;td&gt; &lt;xsl:value-of select="@Time"/&gt;&lt;/td&gt; &lt;td&gt;Line &lt;xsl:value-of select="@Line"/&gt;&lt;/td&gt; &lt;td&gt; &lt;xsl:value-of select="@Type"/&gt;&lt;/td&gt; &lt;td&gt; &lt;xsl:value-of select="@Message"/&gt;&lt;/td&gt; &lt;/tr&gt; &lt;/xsl:for-each&gt; &lt;/table&gt; &lt;/xsl:for-each&gt; &lt;/body&gt; &lt;/html&gt; &lt;/xsl:template&gt; &lt;/xsl:stylesheet&gt; </code></pre> <h2>and the table formed out of the above code can be seen in the jsfiddle link i gave above</h2> <p>My xml file goes here </p> <pre><code> &lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;Report App="RIATest" Version="4.7" Project="D:\Projects\Automation\RIATest\Nomura\Nomura.rtp"&gt; &lt;Startup&gt; &lt;Message Time="2012-08-30 15:32:38.578" Type="Info" Message="Launching iexplore.exe &amp;quot;http://mobiuss-dev.operasolutions.com:8080/nomura-test/&amp;quot;"/&gt; &lt;Message Time="2012-08-30 15:32:38.625" Type="Info" Message="Application launched (process id=4108)."/&gt; &lt;Message Time="2012-08-30 15:32:38.625" Type="Info" Message="Waiting for connection from agent..."/&gt; &lt;Message Time="2012-08-30 15:32:46.453" Type="Info" Message="Agent connection accepted. Application id=nomura-ui, index=0"/&gt; &lt;/Startup&gt; &lt;Scripts&gt; &lt;Script File="Login.rts" Time="2012-08-30 15:32:46.468"&gt; &lt;Message Time="2012-08-30 15:32:46.531" Type="Verification" Line="8" Col="58" Message="Verification passed: SparkApplication(&amp;quot;nomura-ui&amp;quot;)=&amp;gt;visible is equal to true"/&gt; &lt;Message Time="2012-08-30 15:32:46.578" Type="Verification" Line="10" Col="50" Message="Verification passed: FlexForm(&amp;quot;loginForm&amp;quot;)=&amp;gt;visible is equal to true"/&gt; &lt;Message Time="2012-08-30 15:32:46.625" Type="Verification" Line="12" Col="65" Message="Verification passed: FlexLabel(&amp;quot;Username::Username:&amp;quot;)=&amp;gt;text is equal to &amp;quot;Username:&amp;quot;"/&gt; &lt;Message Time="2012-08-30 15:32:46.656" Type="Verification" Line="14" Col="65" Message="Verification passed: FlexLabel(&amp;quot;Password::Password:&amp;quot;)=&amp;gt;text is equal to &amp;quot;Password:&amp;quot;"/&gt; &lt;Message Time="2012-08-30 15:32:46.671" Type="Verification" Line="17" Col="39" Message="Verification passed: comp=&amp;gt;label is equal to &amp;quot;Log In&amp;quot;"/&gt; &lt;Message Time="2012-08-30 15:32:46.703" Type="Verification" Line="18" Col="35" Message="Verification passed: comp=&amp;gt;enabled is equal to true"/&gt; &lt;Message Time="2012-08-30 15:32:46.718" Type="Verification" Line="19" Col="35" Message="Verification passed: comp=&amp;gt;visible is equal to true"/&gt; &lt;Message Time="2012-08-30 15:32:46.734" Type="Verification" Line="22" Col="35" Message="Verification passed: comp=&amp;gt;enabled is equal to true"/&gt; &lt;Message Time="2012-08-30 15:32:46.750" Type="Verification" Line="23" Col="54" Message="Verification passed: comp=&amp;gt;label is equal to &amp;quot;Forgot your password?&amp;quot;"/&gt; &lt;Message Time="2012-08-30 15:32:46.765" Type="Verification" Line="24" Col="36" Message="Verification passed: comp=&amp;gt;selected is equal to false"/&gt; &lt;Message Time="2012-08-30 15:32:46.781" Type="Verification" Line="25" Col="35" Message="Verification passed: comp=&amp;gt;visible is equal to true"/&gt; &lt;Message Time="2012-08-30 15:32:46.796" Type="Verification" Line="28" Col="61" Message="Verification passed: comp=&amp;gt;text is equal to &amp;quot;CORPORATE BOND SPREAD SIGNAL&amp;quot;"/&gt; &lt;Message Time="2012-08-30 15:32:46.812" Type="Verification" Line="29" Col="35" Message="Verification passed: comp=&amp;gt;visible is equal to true"/&gt; &lt;Message Time="2012-08-30 15:32:46.906" Type="Action" Line="32" Col="64" Message="SparkTextInput(&amp;quot;Username::userName&amp;quot;)=&amp;gt;textSelectionChange(0,0)"/&gt; &lt;Message Time="2012-08-30 15:32:47.000" Type="Action" Line="33" Col="63" Message="SparkTextInput(&amp;quot;Username::userName&amp;quot;)=&amp;gt;textInput(&amp;quot;arun.sekar&amp;quot;)"/&gt; &lt;Message Time="2012-08-30 15:32:47.031" Type="Action" Line="35" Col="61" Message="SparkTextInput(&amp;quot;Password::password&amp;quot;)=&amp;gt;textInput(&amp;quot;opera100&amp;quot;)"/&gt; &lt;Message Time="2012-08-30 15:32:47.093" Type="Action" Line="36" Col="32" Message="SparkButton(&amp;quot;Log In&amp;quot;)=&amp;gt;click()"/&gt; &lt;/Script&gt; &lt;/Scripts&gt; &lt;Results&gt; &lt;Summary scripts="2" time="8.515" errors="2"/&gt; &lt;Script name="Login.rts" time="0.625" errors="0"/&gt; &lt;Script name="NOM_0002.rts" time="50.000" errors="2" message="Verification failed: comp=&amp;gt;selected is not equal to expected value true, it is actually equal to false"/&gt; &lt;/Results&gt; &lt;/Report&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload