📄 metadata.xsl.svn-base
字号:
<?xml version="1.0" encoding="UTF-8"?><xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xalan= "http://xml.apache.org/xalan" exclude-result-prefixes="xalan" xmlns:geonet="http://www.fao.org/geonetwork"> <xsl:include href="metadata-utils.xsl"/> <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - --> <!-- main schema switch --> <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - --> <xsl:template mode="elementEP" match="*|@*"> <xsl:param name="schema"> <xsl:apply-templates mode="schema" select="."/> </xsl:param> <xsl:param name="edit" select="false()"/> <xsl:choose> <!-- ISO 19115 --> <xsl:when test="$schema='iso19115'"> <xsl:apply-templates mode="iso19115" select="." > <xsl:with-param name="schema" select="$schema"/> <xsl:with-param name="edit" select="$edit"/> </xsl:apply-templates> </xsl:when> <!-- ISO 19139 --> <xsl:when test="$schema='iso19139'"> <xsl:apply-templates mode="iso19139" select="." > <xsl:with-param name="schema" select="$schema"/> <xsl:with-param name="edit" select="$edit"/> </xsl:apply-templates> </xsl:when> <!-- FGDC --> <xsl:when test="$schema='fgdc-std'"> <xsl:apply-templates mode="fgdc-std" select="." > <xsl:with-param name="schema" select="$schema"/> <xsl:with-param name="edit" select="$edit"/> </xsl:apply-templates> </xsl:when> <!-- Dublin Core --> <xsl:when test="$schema='dublin-core'"> <xsl:apply-templates mode="dublin-core" select="." > <xsl:with-param name="schema" select="$schema"/> <xsl:with-param name="edit" select="$edit"/> </xsl:apply-templates> </xsl:when> <!-- default, no schema-specific formatting --> <xsl:otherwise> <xsl:apply-templates mode="element" select="."> <xsl:with-param name="schema" select="$schema"/> <xsl:with-param name="edit" select="$edit"/> </xsl:apply-templates> </xsl:otherwise> </xsl:choose> </xsl:template> <!-- new children --> <xsl:template mode="elementEP" match="geonet:child"> <xsl:param name="schema"/> <xsl:param name="edit" select="false()"/> <!-- draw new children if - it is not simple mode and - it is an OR element or - it does not exists a preceding brother --> <xsl:variable name="name"> <xsl:choose> <xsl:when test="@prefix=''"><xsl:value-of select="@name"/></xsl:when> <xsl:otherwise><xsl:value-of select="concat(@prefix,':',@name)"/></xsl:otherwise> </xsl:choose> </xsl:variable> <xsl:variable name="prevBrother" select="preceding-sibling::*[1]"/> <xsl:if test="$currTab!='simple' and (geonet:choose or name($prevBrother)!=$name)"> <xsl:variable name="text"> <xsl:if test="geonet:choose"> <select class="md" name="_{../geonet:element/@ref}_{@name}" size="1"> <xsl:for-each select="geonet:choose"> <option value="{@name}"> <xsl:call-template name="getTitle"> <xsl:with-param name="name" select="@name"/> <xsl:with-param name="schema" select="$schema"/> </xsl:call-template> </option> </xsl:for-each> </select> </xsl:if> </xsl:variable> <xsl:variable name="addLink"> <xsl:choose> <xsl:when test="geonet:choose"> <xsl:value-of select="concat('javascript:doNewORElementAction(',$apos,/root/gui/locService,'/metadata.elem.add',$apos,',',../geonet:element/@ref,',',$apos,@name,$apos,',document.mainForm._',../geonet:element/@ref,'_',@name,'.value);')"/> </xsl:when> <xsl:otherwise> <xsl:value-of select="concat('javascript:doNewElementAction(',$apos,/root/gui/locService,'/metadata.elem.add',$apos,',',../geonet:element/@ref,',',$apos,@name,$apos,');')"/> </xsl:otherwise> </xsl:choose> </xsl:variable> <xsl:variable name="helpLink"> <xsl:call-template name="getHelpLink"> <xsl:with-param name="name" select="$name"/> <xsl:with-param name="schema" select="$schema"/> </xsl:call-template> </xsl:variable> <xsl:call-template name="simpleElementGui"> <xsl:with-param name="title"> <xsl:call-template name="getTitle"> <xsl:with-param name="name" select="$name"/> <xsl:with-param name="schema" select="$schema"/> </xsl:call-template> </xsl:with-param> <xsl:with-param name="text" select="$text"/> <xsl:with-param name="addLink" select="$addLink"/> <xsl:with-param name="helpLink" select="$helpLink"/> </xsl:call-template> </xsl:if> </xsl:template> <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - --> <!-- callbacks from schema templates --> <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - --> <xsl:template mode="element" match="*|@*"> <xsl:param name="schema"/> <xsl:param name="edit" select="false()"/> <xsl:param name="flat" select="false()"/> <xsl:choose> <!-- has children or attributes, existing or potential --> <xsl:when test="*[namespace-uri(.)!=$geonetUri]|@*|geonet:child|geonet:element/geonet:attribute"> <xsl:choose> <!-- display as a list --> <xsl:when test="$flat=true()"> <!-- if it does not have children show it as a simple element --> <xsl:if test="not(*[namespace-uri(.)!=$geonetUri]|geonet:child|geonet:element/geonet:attribute)"> <xsl:apply-templates mode="simpleElement" select="."> <xsl:with-param name="schema" select="$schema"/> <xsl:with-param name="edit" select="$edit"/> </xsl:apply-templates> </xsl:if> <!-- existing attributes --> <xsl:apply-templates mode="simpleElement" select="@*"> <xsl:with-param name="schema" select="$schema"/> <xsl:with-param name="edit" select="$edit"/> </xsl:apply-templates> <!-- new attributes --> <!-- FIXME <xsl:apply-templates mode="elementEP" select="geonet:attribute"> <xsl:with-param name="schema" select="$schema"/> <xsl:with-param name="edit" select="$edit"/> </xsl:apply-templates> --> <!-- existing and new children --> <xsl:apply-templates mode="elementEP" select="*[namespace-uri(.)!=$geonetUri]|geonet:child"> <xsl:with-param name="schema" select="$schema"/> <xsl:with-param name="edit" select="$edit"/> </xsl:apply-templates> </xsl:when> <!-- display boxed --> <xsl:otherwise> <xsl:apply-templates mode="complexElement" select="."> <xsl:with-param name="schema" select="$schema"/> <xsl:with-param name="edit" select="$edit"/> </xsl:apply-templates> </xsl:otherwise> </xsl:choose> </xsl:when> <!-- neither children nor attributes, just text --> <xsl:otherwise> <xsl:apply-templates mode="simpleElement" select="."> <xsl:with-param name="schema" select="$schema"/> <xsl:with-param name="edit" select="$edit"/> </xsl:apply-templates> </xsl:otherwise> </xsl:choose> </xsl:template> <xsl:template mode="simpleElement" match="*"> <xsl:param name="schema"/> <xsl:param name="edit" select="false()"/> <xsl:param name="title"> <xsl:call-template name="getTitle"> <xsl:with-param name="name" select="name(.)"/> <xsl:with-param name="schema" select="$schema"/> </xsl:call-template> </xsl:param> <xsl:param name="text"> <xsl:call-template name="getElementText"> <xsl:with-param name="schema" select="$schema"/> <xsl:with-param name="edit" select="$edit"/> </xsl:call-template> </xsl:param> <xsl:param name="helpLink"> <xsl:call-template name="getHelpLink"> <xsl:with-param name="name" select="name(.)"/> <xsl:with-param name="schema" select="$schema"/> </xsl:call-template> </xsl:param> <xsl:choose> <xsl:when test="$edit=true()"> <xsl:call-template name="editSimpleElement"> <xsl:with-param name="schema" select="$schema"/> <xsl:with-param name="title" select="$title"/> <xsl:with-param name="text" select="$text"/> <xsl:with-param name="helpLink" select="$helpLink"/> </xsl:call-template> </xsl:when> <xsl:otherwise> <xsl:call-template name="showSimpleElement"> <xsl:with-param name="schema" select="$schema"/> <xsl:with-param name="title" select="$title"/> <xsl:with-param name="text" select="$text"/> <xsl:with-param name="helpLink" select="$helpLink"/> </xsl:call-template> </xsl:otherwise> </xsl:choose> </xsl:template> <xsl:template mode="simpleElement" match="@*"> <xsl:param name="schema"/> <xsl:param name="edit" select="false()"/> <xsl:param name="title"> <xsl:call-template name="getTitle"> <xsl:with-param name="name" select="name(.)"/> <xsl:with-param name="schema" select="$schema"/> </xsl:call-template> </xsl:param> <xsl:param name="text"> <xsl:call-template name="getAttributeText"> <xsl:with-param name="schema" select="$schema"/> <xsl:with-param name="edit" select="$edit"/> </xsl:call-template> </xsl:param> <xsl:param name="helpLink"> <xsl:call-template name="getHelpLink"> <xsl:with-param name="name" select="name(.)"/> <xsl:with-param name="schema" select="$schema"/> </xsl:call-template> </xsl:param> <xsl:choose> <xsl:when test="$edit=true()"> <xsl:call-template name="editAttribute"> <xsl:with-param name="schema" select="$schema"/> <xsl:with-param name="title" select="$title"/> <xsl:with-param name="text" select="$text"/> <xsl:with-param name="helpLink" select="$helpLink"/> </xsl:call-template> </xsl:when> <xsl:otherwise> <xsl:call-template name="showSimpleElement"> <xsl:with-param name="schema" select="$schema"/> <xsl:with-param name="title" select="$title"/> <xsl:with-param name="text" select="$text"/> <xsl:with-param name="helpLink" select="$helpLink"/> </xsl:call-template> </xsl:otherwise> </xsl:choose> </xsl:template> <xsl:template mode="complexElement" match="*"> <xsl:param name="schema"/> <xsl:param name="edit" select="false()"/> <xsl:param name="title"> <xsl:call-template name="getTitle"> <xsl:with-param name="name" select="name(.)"/> <xsl:with-param name="schema" select="$schema"/> </xsl:call-template> </xsl:param> <xsl:param name="content"> <xsl:call-template name="getContent"> <xsl:with-param name="schema" select="$schema"/> <xsl:with-param name="edit" select="$edit"/> </xsl:call-template> </xsl:param> <xsl:param name="helpLink"> <xsl:call-template name="getHelpLink"> <xsl:with-param name="name" select="name(.)"/> <xsl:with-param name="schema" select="$schema"/> </xsl:call-template> </xsl:param> <xsl:choose> <xsl:when test="$edit=true()"> <xsl:call-template name="editComplexElement"> <xsl:with-param name="schema" select="$schema"/> <xsl:with-param name="title" select="$title"/> <xsl:with-param name="content" select="$content"/> <xsl:with-param name="helpLink" select="$helpLink"/> </xsl:call-template> </xsl:when> <xsl:otherwise> <xsl:call-template name="showComplexElement"> <xsl:with-param name="schema" select="$schema"/> <xsl:with-param name="title" select="$title"/> <xsl:with-param name="content" select="$content"/> <xsl:with-param name="helpLink" select="$helpLink"/> </xsl:call-template> </xsl:otherwise> </xsl:choose> </xsl:template> <!-- prevent drawing of geonet:* elements --> <xsl:template mode="element" match="geonet:element|geonet:info"/> <xsl:template mode="simpleElement" match="geonet:element|geonet:info"/> <xsl:template mode="complexElement" match="geonet:element|geonet:info"/> <!-- prevent drawing of attributes starting with "_", used in old GeoNetwork versions --> <xsl:template mode="simpleElement" match="@*[starts-with(name(.),'_')]"/> <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - --> <!-- elements/attributes templates --> <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - --> <!-- shows a simple element --> <xsl:template name="showSimpleElement"> <xsl:param name="schema"/> <xsl:param name="title"/> <xsl:param name="text"/> <xsl:param name="helpLink"/> <xsl:call-template name="simpleElementGui"> <xsl:with-param name="title" select="$title"/> <xsl:with-param name="text" select="$text"/> <xsl:with-param name="helpLink" select="$helpLink"/> </xsl:call-template> </xsl:template> <!-- shows a complex element --> <xsl:template name="showComplexElement"> <xsl:param name="schema"/> <xsl:param name="title"/> <xsl:param name="content"/> <xsl:param name="helpLink"/> <xsl:call-template name="complexElementGui"> <xsl:with-param name="title" select="$title"/> <xsl:with-param name="text" select="text()"/> <xsl:with-param name="content" select="$content"/> <xsl:with-param name="helpLink" select="$helpLink"/> <xsl:with-param name="schema" select="$schema"/> </xsl:call-template> </xsl:template>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -