Ignore:
Timestamp:
08/25/11 20:21:23 (13 years ago)
Author:
vronk
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • MDService2/trunk/MDService2/src/xsl/test2view.xsl

    r1488 r1495  
    2727<xsl:template match="a">
    2828
     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       
    2949 <div class="cmds-ui-block" >
    3050         <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>]
     51                <xsl:value-of select="@class" />: <xsl:copy-of select="." /> [<a href="{concat($base_url,$specific_prefix,@href)}" ><xsl:value-of select="@href" /></a>]
    3252        </div> 
    3353       
    3454        <div class="ui-widget-content">
    3555                <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//*)" />
     56                        <xsl:when test="exists($data/diagnostics)">
     57                                <span class="error" >
     58                                        <xsl:value-of select="$data/diagnostics/diag:diagnostic/diag:message" />
     59                                </span>
    3960                        </xsl:when>
    40                         <xsl:when test="@class='query'">
     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'">
    4169                                        <xsl:variable name="data" select="document(concat($base_url,'recordset/htmltable/', @href))" />
    4270                                        <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>
     71                        </xsl:when> -->         
    4872                        <xsl:otherwise>
    49                                         <xsl:apply-templates select="document(concat($base_url,@href))" mode="process-query"/>
     73<!--                                    <xsl:apply-templates select="$data" mode="process-result"/>-->                         
     74                                        <xsl:copy-of select="$data" />
    5075                        </xsl:otherwise>
    5176                </xsl:choose>
     
    6186</xsl:template>
    6287
    63 <xsl:template match="*|@*" mode="process-query" >
     88<xsl:template match="*|@*" mode="process-result" >
    6489        <xsl:copy>
    65                 <xsl:apply-templates select="node()|@*" mode="process-query" />
     90                <xsl:apply-templates select="node()|@*" mode="process-result" />
    6691        </xsl:copy>     
    6792</xsl:template>
     
    7398    <message>Exception occurred: Connection refused: connect</message>
    7499-->
    75 <xsl:template match="diagnostics" mode="process-query" >
     100<xsl:template match="diagnostics" mode="process-result" >
    76101        <div class="error" >
    77102                 <xsl:value-of select="diag:diagnostic/diag:message" />
Note: See TracChangeset for help on using the changeset viewer.