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 | <div class="cmds-ui-block" > |
---|
30 | <div class="ui-widget-header"> |
---|
31 | <xsl:value-of select="@class" />: <xsl:copy-of select="." /> [<a href="{concat($base_url,@href)}" ><xsl:value-of select="@href" /></a>] |
---|
32 | </div> |
---|
33 | |
---|
34 | <div class="ui-widget-content"> |
---|
35 | <xsl:choose> |
---|
36 | <xsl:when test="@class='requestcount'"> |
---|
37 | <xsl:variable name="data" select="document(concat($base_url,@href))" /> |
---|
38 | <xsl:value-of select="count($data//*)" /> |
---|
39 | </xsl:when> |
---|
40 | <xsl:when test="@class='query'"> |
---|
41 | <xsl:variable name="data" select="document(concat($base_url,'recordset/htmltable/', @href))" /> |
---|
42 | <xsl:copy-of select="$data" /> |
---|
43 | </xsl:when> |
---|
44 | <xsl:when test="@class='query count'"> |
---|
45 | <xsl:variable name="data" select="document(concat($base_url,'recordset/xml/', @href))" /> |
---|
46 | <xsl:value-of select="$data//numberOfRecords" /> |
---|
47 | </xsl:when> |
---|
48 | <xsl:otherwise> |
---|
49 | <xsl:apply-templates select="document(concat($base_url,@href))" mode="process-query"/> |
---|
50 | </xsl:otherwise> |
---|
51 | </xsl:choose> |
---|
52 | |
---|
53 | </div> |
---|
54 | </div> |
---|
55 | </xsl:template> |
---|
56 | |
---|
57 | <xsl:template match="*|@*"> |
---|
58 | <xsl:copy> |
---|
59 | <xsl:apply-templates select="node()|@*" /> |
---|
60 | </xsl:copy> |
---|
61 | </xsl:template> |
---|
62 | |
---|
63 | <xsl:template match="*|@*" mode="process-query" > |
---|
64 | <xsl:copy> |
---|
65 | <xsl:apply-templates select="node()|@*" mode="process-query" /> |
---|
66 | </xsl:copy> |
---|
67 | </xsl:template> |
---|
68 | |
---|
69 | <!-- |
---|
70 | <diagnostics> |
---|
71 | <diagnostic xmlns="http://www.loc.gov/zing/srw/diagnostic"> |
---|
72 | <uri>info:srw/diagnostic/1/1</uri> |
---|
73 | <message>Exception occurred: Connection refused: connect</message> |
---|
74 | --> |
---|
75 | <xsl:template match="diagnostics" mode="process-query" > |
---|
76 | <div class="error" > |
---|
77 | <xsl:value-of select="diag:diagnostic/diag:message" /> |
---|
78 | </div> |
---|
79 | </xsl:template> |
---|
80 | |
---|
81 | |
---|
82 | </xsl:stylesheet> |
---|
83 | |
---|