我们正在开展一个GSA项目。我们使用的是GSA 7.2版和Connector数据库适配器3.2.4。 那个SQL为
SELECT EMPLOYEE_ID,
FIRST_NAME,
LAST_NAME,
EMAIL,
PHONE_NUMBER,
HIRE_DATE,
JOB_ID,
SALARY,
COMMISSION_PCT,
MANAGER_ID,
DEPARTMENT_ID
FROM HR.EMPLOYEES ;
如何编写“用于提供结果的样式表”,以显示来自SQL的所有元数据。
答案 0 :(得分:2)
您必须自定义样式表,如下所示:
`<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:template match="/">
<html>
<head>
<xsl:for-each select="pland_connector"> <!-- name of connector -->
<!-- now for every single field from the database you want to be able to filter upon or show in your result, add a meta-field -->
<title><xsl:value-of select="LAST_NAME"/></title> <!-- don't forget the title -> that is the default title in the GSA result -->
<meta name="EMPLOYEE_ID"><xsl:attribute name="content"><xsl:value-of select="EMPLOYEE_ID"/></xsl:attribute></meta>
<!-- mind the capital sensitivity of XML, dependend on the notation in you db view or table the value-of should be in capitals or not -->
<meta name="LAST_NAME"><xsl:attribute name="content"><xsl:value-of select="LAST_NAME"/></xsl:attribute></meta>
<meta name="FIRST_NAME"><xsl:attribute name="content"><xsl:value-of select="FIRST_NAME"/></xsl:attribute></meta>
<meta name="EMAIL"><xsl:attribute name="content"><xsl:value-of select="EMAIL"/></xsl:attribute></meta>
<meta name="PHONE_NUMBER"><xsl:attribute name="content"><xsl:value-of select="PHONE_NUMBER"/></xsl:attribute></meta>
<!-- Etc..... -->
</xsl:for-each>
<!-- You can add static metadata to -->
<meta name="test" content="Person"/>
</head>
<body>
<!-- Just see what data you want in the content-field -->
<xsl:for-each select="pland_connector"> <!-- Name of database -->
<h1><xsl:value-of select="NAME"/></h1></br>
</xsl:for-each>
</body>
</html>
</xsl:template>
</xsl:stylesheet>`
我想你会完成的。