How can I use stylesheet to customize the display of meta data in ArcGIS?

Source: Internet
Author: User

The storage format of metadata is XML. The basic idea of XML for Document Browsing is to define the display of data and data separately. XML documents themselves do not involve specific display methods of various data, the document is displayed in an external style table, also known as a style sheet.

   A style sheet is like a query that selects data from a database. The metadata style table can select what metadata elements are displayed and define how these metadata elements are displayed. Each style table in arccatlog uses different rules to display the same metadata. 1.

                    

                                          Figure
1
Use different style sheets to display metadata

  

  Multiple style sheets are provided in ArcInfo for users to display metadata in different formats. The metadata includes: fgdc, fgdc ESRI, fgdc classic, fgdc FAQ, fgdc Geography Network, ISO, ISO Geography Network, etc. The fgdc style sheet only contains the standard metadata of fgdc. The ISO style sheet displays iso-compliant metadata. If you have extended the fgdc standard or ISO standard and set your own metadata standard, you need to customize the style sheet to display additional metadata information. In addition, you can customize a style sheet based on your preferences, including filtering out unnecessary metadata, replacing metadata values (such as replacing keywords in Chinese and English), and interface art.

XSL (Extensible style sheet language), a language that converts XML into HTML, a language that can filter and classify XML data.

   To convert an XSL style to an HTML document, first use the XML interpreter to interpret the XML document as a DOM object, which is equivalent to creating a node tree of the original document. Then, the XML interpreter is used to explain the XSL document, and the template matching method is used to traverse the XML node tree. the nodes in the tree are converted to the display language indicated by the template according to the template settings.

The main functions of tessert:

  • The following describes the syntax of the XSL language.

1. XSL: For-each select = "metadata/idinfo/citation/citeinfo/origin" loop statement, traversing the nodes specified in quotation marks;

2. XSL: value-of select = "metadata/idinfo/citation/citeinfo/origin" value assignment statement to retrieve the value of the node specified in the quotation marks

3. XSL: If test = "metadata/spref/horizsys/cordsysn/projcsn [.! = '']" Judgment statement to determine whether a node is equal to a value;

4. Select the statement XSL: Choose and XSL: When test = "", which is equivalent to selecting data using the case statement.

  • Example

1. Example of a loop statement and a value assignment statement:

The following statement shows the data Publisher:

<Div style = "font-weight: bold; color: # b22222"> "〉
Who created this data? <〈! -- Who created the data? --> --〉
</Div> 〉

This statement is a pure HTML language used to display titles. If you want to conform to Chinese users' habits, you can replace it with Chinese:

<Div style = "font-weight: bold; color: # b22222"> "〉

Who created the data?

</Div> 〉
<XSL: For-each select = "metadata/idinfo/citation/citeinfo/origin"> "〉
<Div style = "margin-left: 0.25in; color: #696969"> "〉
<XSL: value-of/> /〉
</Div> 〉
</XSL: For-each> 〉
<Br/> /〉

Here we use a loop statement and a value assignment statement to extract the metadata/idinfo/citation/citeinfo/origin value from the metadata and display it on the HTML page.

If you have added a custom node, you can also read it using the select Syntax of XSL, as shown in the following code:

<Div style = "font-weight: bold; color: # b22222"> "〉

Input personnel Name:

</Div> 〉
<XSL: For-each select = "metadata/custom/inputperson"> "〉
<Div style = "margin-left: 0.25in; color: #696969"> "〉
<XSL: value-of/> /〉
</Div> 〉
</XSL: For-each> 〉
<Br/> /〉

2. Example of a judgment statement:

The following code is used to display the projection coordinate system of data:

<Div style = "font-weight: bold; color: # b22222"> "〉

What is the coordinate system of this data?

</Div> 〉
<XSL: If test = "metadata/spref/horizsys/cordsysn/projcsn [.! = '']">
<Div style = "margin-left: 0.25in; color: #696969"> "〉
<Span style = "font-weight: bold"> projection Coordinate System: </span> 〉
<XSL: value-of select = "metadata/spref/horizsys/cordsysn/projcsn"/> "/〉
</Div> 〉
</XSL: If> 〉

The IF judgment statement is used: <XSL: If test = "metadata/spref/horizsys/cordsysn/projcsn [.! = '']"> If no node metadata is null, data is displayed.

3. Example of a SELECT statement:

<XSL: Choose> 〉
<XSL: When test = "metadata/distinfo/resdesc [. = 'Live data and maps']">
<Div style = "margin-left: 0.25in; color: #696969"> "〉
Dynamic Maps and Data
</Div> 〉
</XSL: When> 〉
</XSL: Choose> 〉

This can be used to replace keywords during customization. fgdc standard metadata keywords are in English. If you want to see Chinese keywords, you can use the select judgment statement to test the value of the metadata/distinfo/resdesc node and replace it with different values, the above code replaces the keyword 'Live data and maps 'with 'dynamic map and data'

After learning these basic XSL syntaxes, you can customize the metadata according to your requirements. The rest of the work is to use XSL to design the style of the entire page, and try to achieve the unified and beautiful format. The metadata node information can be obtained from the metadata XML document.

After writing the XSL file, put it in the % arcgishome % \ metadata \ stylesheets directory. The options are automatically displayed in the metadata Toolbar of arccatlog and metadata is displayed using the new XSL file. 2:

Figure 2Select a style sheet in arccatlog

Result 3 is displayed based on the metadata of the custom style sheet.

Figure 3: Display metadata using a custom style sheet

   This article briefly introduces how to use the XSL language to customize style sheets and how to support user-defined metadata nodes. developers can use the methods provided in this article to create various style sheets, in this way, metadata information is displayed to users in different ways.

 

From: http://blog.sina.com.cn/s/blog_5e2b0e870100mf4b.html

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.