• Topic
  • Discussion
  • VOS.VirtFacetBrowserAPIsFCTEXECxsl(Last) -- Owiki? , 2018-04-13 12:06:27 Edit owiki 2018-04-13 07:06:27

    fct_exec Service Sample Example xsl content


    <?xml version="1.0" encoding="utf-8"?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
      <xsl:output method="html" encoding="ISO-8859-1"/>
      <xsl:variable name="rowcnt" select="count(/facets/result/row)"/>
      <xsl:template match="facets">
        <div id="res">
          <xsl:if test="/facets/complete = 'yes' and /facets/processed = 0 and $rowcnt = 0">
            <div class="empty_result">
              Nothing found.
            </div>
          </xsl:if>
          <xsl:for-each select="/facets/result">
            <xsl:call-template name="render-result"/>
          </xsl:for-each>
        </div>
        <!-- #res -->
      </xsl:template>
      <xsl:template name="render-result">
        <table class="result" border="1">
          <thead>
            <tr>
              <th>Entity</th>
              <th>Title</th>
              <th>Text excerpt</th>
            </tr>
          </thead>
          <tbody>
            <xsl:for-each select="row">
              <tr>
                <td class="rnk">
                  <xsl:for-each select="column[@datatype='trank' or @datatype='erank']">
                    <xsl:choose>
                      <xsl:when test="./@datatype='trank'">Text Rank:</xsl:when>
                      <xsl:when test="./@datatype='erank'">Entity Rank:</xsl:when>
                    </xsl:choose>
                    <xsl:value-of select="."/>
                    <br/>
                  </xsl:for-each>
                </td>
                <xsl:for-each select="column">
                  <xsl:choose>
                    <xsl:when test="'url' = ./@datatype">
                      <td>
                        <a>
                          <xsl:attribute name="href">http://lod.openlinksw.com/describe/?url=<xsl:value-of select="urlify (.)"/></xsl:attribute>
                          <xsl:attribute name="title"><xsl:value-of select="."/></xsl:attribute>
                          <xsl:choose>
                            <xsl:when test="'' != ./@shortform">
                              <xsl:value-of select="./@shortform"/>
                            </xsl:when>
                            <xsl:when test="'erank' = ./@datatype or 'trank' = ./@datatype">rank</xsl:when>
                            <xsl:otherwise>
                              <xsl:value-of select="."/>
                            </xsl:otherwise>
                          </xsl:choose>
                        </a>
                      </td>
                    </xsl:when>
                    <xsl:when test="'erank' = ./@datatype or 'trank' = ./@datatype"/>
                    <xsl:when test="'srch_xerpt' = ./span/@class">
                      <td>
                        <xsl:value-of select="."/>
                      </td>
                    </xsl:when>
                    <xsl:otherwise/>
                  </xsl:choose>
                </xsl:for-each>
              </tr>
            </xsl:for-each>
          </tbody>
        </table>
      </xsl:template>
      <xsl:template match="@* | node()">
        <xsl:copy>
          <xsl:apply-templates select="@* | node()"/>
        </xsl:copy>
      </xsl:template>
    </xsl:stylesheet>
    

    Related