Skip to content

Commit

Permalink
added NUDS XSD rendering and download
Browse files Browse the repository at this point in the history
  • Loading branch information
ewg118 committed Dec 16, 2016
1 parent 8419d3b commit 4a25d82
Show file tree
Hide file tree
Showing 6 changed files with 161 additions and 0 deletions.
1 change: 1 addition & 0 deletions config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
<solr_fuseki>http://localhost:8080/solr/nomisma-fuseki/</solr_fuseki>
<id_path>/usr/local/projects/nomisma-data/id</id_path>
<ontology_path>/usr/local/projects/nomisma-data/ontology</ontology_path>
<nuds_xsd_path>/usr/local/projects/NUDS/nuds.xsd</nuds_xsd_path>
<dump_path>/usr/local/projects/nomisma/dump</dump_path>
<flickr_api_key>226cb53f91a6c1331adfb52c365584e9</flickr_api_key>
<mapboxKey>pk.eyJ1IjoiZXdnMTE4IiwiYSI6IjViNDRlMzgxMjkyMDg0MGIxYTNlMzlkMjk1ZTI5Yzg5In0.1FU6cKAs4-vPMroB_l_0lA</mapboxKey>
Expand Down
4 changes: 4 additions & 0 deletions page-flow.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
<page path="/nomisma/research/distribution" view="xpl/views/pages/vis.xpl"/>
<page path="/nomisma/apis" view="xpl/views/pages/apis.xpl"/>
<page path="/nomisma/datasets" model="xpl/models/sparql/datasets.xpl" view="xpl/views/serializations/sparql/datasets.xpl"/>
<page path="/nomisma/nuds" model="xpl/models/xsd/nuds.xpl" view="xpl/views/serializations/nuds-xsd/html.xpl"/>
<page path="/nomisma/ontology" model="xpl/models/rdf/get-rdf-ontology-current.xpl" view="xpl/controllers/conneg-ontology.xpl"/>
<page path="/nomisma/documentation/(.*)" view="xpl/views/pages/documentation.xpl"/>
<page path="/nomisma/" view="xpl/views/pages/index.xpl"/>
Expand All @@ -64,6 +65,9 @@
<!-- SPARQL -->
<page path="/nomisma/query" view="xpl/controllers/conneg-sparql.xpl"/>

<!-- NUDS XSD -->
<page path="/nomisma/nuds.xsd" view="xpl/models/xsd/nuds.xpl"/>

<!-- **** APIs **** -->
<page path="/nomisma/apis/avgAxis" model="xpl/models/sparql/avgMeasurement.xpl" view="xpl/views/serializations/sparql/avgMeasurement.xpl"/>
<page path="/nomisma/apis/avgDiameter" model="xpl/models/sparql/avgMeasurement.xpl" view="xpl/views/serializations/sparql/avgMeasurement.xpl"/>
Expand Down
77 changes: 77 additions & 0 deletions ui/xslt/serializations/nuds-xsd/html.xsl
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:tei="http://www.tei-c.org/ns/1.0" exclude-result-prefixes="#all" version="2.0">
<xsl:include href="../../templates.xsl"/>

<xsl:variable name="display_path"/>

<xsl:template match="/">
<html lang="en">
<head>
<title>nomisma.org: Numismatic Description Schema (NUDS)</title>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<!-- bootstrap -->
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js"/>
<script type="text/javascript" src="{$display_path}ui/javascript/result_functions.js"/>
<link rel="stylesheet" href="http://netdna.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css"/>
<script src="http://netdna.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"/>
<link rel="stylesheet" href="{$display_path}ui/css/style.css"/>

<!-- google analytics -->
<xsl:if test="string(//config/google_analytics)">
<script type="text/javascript">
<xsl:value-of select="//config/google_analytics"/>
</script>
</xsl:if>
</head>
<body>
<xsl:call-template name="header"/>
<xsl:call-template name="body"/>
<xsl:call-template name="footer"/>
</body>
</html>
</xsl:template>

<xsl:template name="body">
<div class="container-fluid content">
<div class="row">
<div class="col-md-12">
<h1>Numismatic Description Schema</h1>
<p>Placeholder for documentation on NUDS XSD</p>
<h3>Elements</h3>
<xsl:apply-templates select="descendant::xs:element" mode="toc">
<xsl:sort select="@name" order="ascending"/>
</xsl:apply-templates>
<h3>Attributes</h3>
<hr/>
<xsl:apply-templates select="descendant::xs:element" mode="desc">
<xsl:sort select="@name" order="ascending"/>
</xsl:apply-templates>
</div>
</div>
</div>
</xsl:template>

<xsl:template match="xs:element" mode="toc">
<a href="#{@name}">
<xsl:value-of select="@name"/>
</a>
<xsl:text> </xsl:text>
</xsl:template>

<xsl:template match="xs:element" mode="desc">
<div id="{@name}">
<h4>
<xsl:value-of select="@name"/>
</h4>
<xsl:apply-templates select="xs:annotation/xs:documentation"/>
</div>
</xsl:template>

<xsl:template match="xs:documentation">
<p>
<xsl:value-of select="."/>
</p>
</xsl:template>

</xsl:stylesheet>
3 changes: 3 additions & 0 deletions ui/xslt/templates.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Documentation <b class="caret"/></a>
<ul class="dropdown-menu">
<li>
<a href="{$display_path}nuds">Numismatic Description Schema (NUDS)</a>
</li>
<xsl:for-each select="//config/documentation/page">
<li>
<a href="{$display_path}documentation/{@stub}">
Expand Down
33 changes: 33 additions & 0 deletions xpl/models/xsd/nuds.xpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<p:pipeline xmlns:p="http://www.orbeon.com/oxf/pipeline"
xmlns:oxf="http://www.orbeon.com/oxf/processors">

<p:param type="input" name="data"/>
<p:param type="output" name="data"/>

<p:processor name="oxf:unsafe-xslt">
<p:input name="data" href="../../../config.xml"/>
<p:input name="config">
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output indent="yes"/>
<xsl:template match="/">
<config>
<url>
<xsl:value-of select="concat('file://', /config/nuds_xsd_path)"/>
</url>
<mode>xml</mode>
<content-type>application/xml</content-type>
<encoding>utf-8</encoding>
</config>
</xsl:template>
</xsl:stylesheet>
</p:input>
<p:output name="data" id="url-generator-config"/>
</p:processor>

<p:processor name="oxf:url-generator">
<p:input name="config" href="#url-generator-config"/>
<p:output name="data" ref="data"/>
</p:processor>
</p:pipeline>

43 changes: 43 additions & 0 deletions xpl/views/serializations/nuds-xsd/html.xpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (C) 2010 Ethan Gruber
EADitor: http://code.google.com/p/eaditor/
Apache License 2.0: http://code.google.com/p/eaditor/
-->
<p:config xmlns:p="http://www.orbeon.com/oxf/pipeline"
xmlns:oxf="http://www.orbeon.com/oxf/processors">

<p:param type="input" name="data"/>
<p:param type="output" name="data"/>

<p:processor name="oxf:request">
<p:input name="config">
<config>
<include>/request</include>
</config>
</p:input>
<p:output name="data" id="request"/>
</p:processor>

<p:processor name="oxf:unsafe-xslt">
<p:input name="request" href="#request"/>
<p:input name="data" href="aggregate('content', #data, ../../../../config.xml)"/>
<p:input name="config" href="../../../../ui/xslt/serializations/nuds-xsd/html.xsl"/>
<p:output name="data" id="model"/>
</p:processor>

<p:processor name="oxf:html-converter">
<p:input name="data" href="#model"/>
<p:input name="config">
<config>
<version>5.0</version>
<indent>true</indent>
<content-type>text/html</content-type>
<encoding>utf-8</encoding>
<indent-amount>4</indent-amount>
</config>
</p:input>
<p:output name="data" ref="data"/>
</p:processor>
</p:config>

0 comments on commit 4a25d82

Please sign in to comment.