source: MDService2/trunk/MDService2/src/xsl/test2view.xsl @ 1495

Last change on this file since 1495 was 1495, checked in by vronk, 13 years ago

started cleaning up code, adding inline-documentation;
also changes to output method in xsl (xhtml)

File size: 3.2 KB
Line 
1<?xml version="1.0"?>
2<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
3 xmlns:diag="http://www.loc.gov/zing/srw/diagnostic">
4
5<!--
6<purpose>special stylesheet for running test-queries defined as links in the input file</purpose>
7<params>
8<param name=""></param>
9</params>
10<history>
11        <change on="2011-05-23" type="created" by="vr">based on xml2htmltable</change> 
12       
13</history>
14-->
15
16<xsl:include href="cmd_commons.xsl"/> 
17
18<xsl:param name="title" select="if (//div[1][@class='title']) then concat('CMDRSB: ', //div[1][@class='title']) else 'CMDRSB docs'" />
19
20       
21<!--<xsl:output method="html" encoding="UTF-8"/>-->
22
23<xsl:template name="continue-root">
24                <xsl:apply-templates  />
25</xsl:template>
26
27<xsl:template match="a">
28
29 <xsl:variable name="specific_prefix" select="if (contains(@href,'query')) then 'recordset/htmlpage/' else ''" />
30 
31 <xsl:variable name="data" >
32        <xsl:choose>                   
33                        <xsl:when test="@class='request count'">
34                                        <xsl:copy-of select="document(concat($base_url,@href))" />                                     
35                        </xsl:when>
36                        <xsl:when test="@class='query count'">
37                                        <xsl:copy-of select="document(concat($base_url, 'recordset/xml/', @href))" />                                                                           
38                        </xsl:when>             
39                        <xsl:when test="@class='query'">
40                                        <xsl:copy-of select="document(concat($base_url, 'recordset/htmltable/', @href))"  />                                                                           
41                        </xsl:when>             
42                        <xsl:otherwise>
43                                        <xsl:copy-of select="document(concat($base_url, @href))"  />
44                        </xsl:otherwise>
45                </xsl:choose>   
46 </xsl:variable>
47
48       
49 <div class="cmds-ui-block" >
50         <div class="ui-widget-header">
51                <xsl:value-of select="@class" />: <xsl:copy-of select="." /> [<a href="{concat($base_url,$specific_prefix,@href)}" ><xsl:value-of select="@href" /></a>]
52        </div> 
53       
54        <div class="ui-widget-content">
55                <xsl:choose>
56                        <xsl:when test="exists($data/diagnostics)">
57                                <span class="error" >
58                                        <xsl:value-of select="$data/diagnostics/diag:diagnostic/diag:message" />
59                                </span>
60                        </xsl:when>
61                        <xsl:when test="@class='request count'">
62                                root: <xsl:value-of select="$data/*/name()" />|<xsl:value-of select="count($data//*)" />|
63                        </xsl:when>
64                        <xsl:when test="@class='query count'">
65                                                        <xsl:value-of select="$data//numberOfRecords" />
66                                                        </xsl:when>
67                       
68                        <!-- <xsl:when test="@class='query'">
69                                        <xsl:variable name="data" select="document(concat($base_url,'recordset/htmltable/', @href))" />
70                                        <xsl:copy-of select="$data" />
71                        </xsl:when> -->         
72                        <xsl:otherwise>
73<!--                                    <xsl:apply-templates select="$data" mode="process-result"/>-->                         
74                                        <xsl:copy-of select="$data" />
75                        </xsl:otherwise>
76                </xsl:choose>
77                               
78        </div>
79 </div>
80</xsl:template>
81
82<xsl:template match="*|@*">
83        <xsl:copy>
84                <xsl:apply-templates select="node()|@*" />
85        </xsl:copy>     
86</xsl:template>
87
88<xsl:template match="*|@*" mode="process-result" >
89        <xsl:copy>
90                <xsl:apply-templates select="node()|@*" mode="process-result" />
91        </xsl:copy>     
92</xsl:template>
93
94<!--
95 <diagnostics>
96        <diagnostic xmlns="http://www.loc.gov/zing/srw/diagnostic">
97    <uri>info:srw/diagnostic/1/1</uri>   
98    <message>Exception occurred: Connection refused: connect</message>
99-->
100<xsl:template match="diagnostics" mode="process-result" >
101        <div class="error" >
102                 <xsl:value-of select="diag:diagnostic/diag:message" />
103        </div> 
104</xsl:template>
105
106
107</xsl:stylesheet>
108 
Note: See TracBrowser for help on using the repository browser.