1 / 15

Application of XSLT Stylesheet to XML

Application of XSLT Stylesheet to XML. - WMO Workshop on Metadata - September 2005, Beijing, China. Atsushi Shimazaki Japan Meteorological Agency. Availability of WMO publications for computer processing.

lavey
Télécharger la présentation

Application of XSLT Stylesheet to XML

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Application of XSLT Stylesheet to XML - WMO Workshop on Metadata - September 2005, Beijing, China Atsushi Shimazaki Japan Meteorological Agency

  2. Availability of WMO publications for computer processing WMO has published diverse types of information for operational meteorological services as regulations, catalogues and so on. Some of them are used in computer processing, for example: REGULATION - Manual on Codes (WMO-No.306) - paper, pdf and doc including BUFR/CREX tables, Common code tables, etc. CATALOGUE - Weather reporting (WMO-No.9) - pdf and text including International station index numbers (Vol.A) Catalogue of meteorological bulletins (Vol. C1) etc. pdf: Adobe(R) acrobat(R), doc: Microsoft(R) Word

  3. Advantages/disadvantages of formats paper - suit for human reading, but computer processing's impossible text, csv(text delimited by comma)- Alphanumeric, line feed, etc. Simple format suit for computer processing, but not for human reading html, doc, xls (MS Excel), pdf- text, character style, etc. suit for human reading and processing, but not for computer processing, expensive software for editing and large volume Rich style info. xls: Microsoft(R) Excel

  4. Basic format of WMO Publications Diverse formats, such as paper, text, pdf, doc, etc. are adopted for WMO Publications for computer processing If information in necessary formats are created from one, it will be useful in both maintenance and utilization. XML can be a basic format for the purpose. Reason: 1) International standard (W3C - World Wide Web Consortium, 1998) 2) Expandability 3) Availability of tools for file conversion

  5. WMO Core Metadata Profile WMO Core Metadata Profile provides information about datasets: such as information for identification, quality, distribution, constraint on access, access measures, geographic extent etc. Introducing WMO Core Metadata Profile into XML will enhance usability of datasets.

  6. Advantages/disadvantages of formats -2 paper - suit for human reading, but computer processing's impossible text, csv(text delimited by comma)- Alphanumeric, line feed, etc. Simple format suit for computer processing, but not for human reading html, doc, xls (MS Excel), pdf- text, character style, etc. Rich style info. suit for human reading and processing, but not for computer processing, expensive software for editing and large volume xml- text with metadata suit for worldwide exchange and computer processing, but not for human processing Metadata and tags xls: Microsoft(R) Excel

  7. Relationship between each format Human processing paper, xls (MS Excel), doc, html , etc. Computer processing Human reading txt, csv, etc. paper, xls, doc, html, etc. Exchange xml with metadata

  8. A possible flow of format conversion focused on XML Human processing xls Manual conversion Computer processing Human reading txt html XSLT style sheet XSLT style sheet Exchange xml with metadata

  9. XSLT Stylesheet What is XSLT Stylesheet: - stands for Extensible Stylesheet Language Transformations - standard of W3C (16 Nov. 1999) - a tool to create text, html and other formats from XML

  10. Migration to Table Driven Code Forms (TDCFs) Dec. 2002 CBS Ext. (02) approved draft Plan for migration to TDCFs May. 2003 Cg-XIV approved draft Plan for migration to TDCFs Nov. 2005 Operational migration of SYNOP, TEMP, CLIMAT etc. will start Encoder/decoder for BUFR/CREX data will be used worldwide. BUFR/CREX tables in computer readable format is indispensable

  11. A possible flow of format conversion focused on XML -2 Human processing xls Manual conversion Computer processing Human reading txt html XSLT style sheet XSLT style sheet Exchange xml with metadata

  12. An example of XSLT stylesheet for text conversion <?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/1999/xhtml1/strict"> <xsl:output method="text" omit-xml-declaration="yes" /> <xsl:template match="/"> <text> <xsl:apply-templates /> </text> </xsl:template> <xsl:template match="MD_Metadata"> <xsl:apply-templates select="data" /> </xsl:template> <xsl:template match="class/subject"> <xsl:text> </xsl:text> <xsl:value-of select="." /> </xsl:template> <xsl:template match="class/body"> <xsl:for-each select="item"> <xsl:text> </xsl:text> <xsl:value-of select="status" />, <xsl:value-of select="tableReferenceF" />, <xsl:value-of select="tableReferenceX" />, <xsl:value-of select="tableReferenceY" />, <xsl:value-of select="elementName" />, <xsl:value-of select="bufr/unit" />, <xsl:value-of select="bufr/scale" />, <xsl:value-of select="bufr/referenceValue" />, <xsl:value-of select="bufr/dataWidthBits" />, <xsl:value-of select="crex/unit" />, <xsl:value-of select="crex/scale" />, <xsl:value-of select="crex/dataWidthCharacters" /> </xsl:for-each> </xsl:template> </xsl:stylesheet>

  13. An example of XSLT stylesheet for html conversion <?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns="http://www.w3.org/1999/xhtml1/strict"> <xsl:template match="/"> <html> <body> <xsl:apply-templates /> </body> </html> </xsl:template> <xsl:template match="MD_Metadata"> <xsl:apply-templates select="data" /> </xsl:template> <xsl:template match="class/subject"> <h1 align="center"> <xsl:value-of select="." /> </h1> </xsl:template> <xsl:template match="class/body"> <table border="1" align="center"> <tr align="center"> <th rowspan="2">Status</th> <th colspan="3">Table Ref</th> <th width="500" rowspan="2">Element Name</th> <th colspan="4">BUFR</th> <th colspan="3">CREX</th> </tr> <tr align="center"> <th>F</th> <th>X</th> <th>Y</th> <th width="80">Unit</th> <th>Scale</th>

  14. <xsl:for-each select="item"> <tr> <td align="center"> <xsl:value-of select="status" /> </td> <td align="center"> <xsl:value-of select="tableReferenceF" /> </td> <td align="center"> <xsl:value-of select="tableReferenceX" /> </td> <td align="center"> <xsl:value-of select="tableReferenceY" /> </td> <td align="left"> <xsl:value-of select="elementName" /> </td> <td align="center"> <xsl:value-of select="bufr/unit" /> </td> <td align="center"> <xsl:value-of select="bufr/scale" /> </td> <td align="center"> <xsl:value-of select="bufr/referenceValue" /> </td> <td align="center"> <xsl:value-of select="bufr/dataWidthBits" /> </td> <td align="center"> <xsl:value-of select="crex/unit" /> </td> <td align="center"> <xsl:value-of select="crex/scale" /> </td> <td align="center"> <xsl:value-of select="crex/dataWidthCharacters" /> </td> </tr> </xsl:for-each> </table> </xsl:template> </xsl:stylesheet>

  15. Summary 1. Diverse formats adopted for WMO Publications, especially intended for computer processing, can be reorganized according to their purpose as follows: a) for maintenance - doc, xsl, etc. b) for exchange - xml c) for computer processing - text, csv d) for human reading - html (also printable) 2. For conversion from b) to c) and d) formats, XSLT Stylesheet can be used. The browser (I.E.) may be used for conversion. 3. This scheme can be applied to other WMO publications for computer processing, such as volumes of WMO-No.9.

More Related