Pi 1 rok temu
rodzic
commit
3c565e1845
2 zmienionych plików z 186 dodań i 0 usunięć
  1. 90 0
      xml/pg_random_view_default_if_null.xhtml
  2. 96 0
      xml/pg_view_style.xsl

+ 90 - 0
xml/pg_random_view_default_if_null.xhtml

@@ -0,0 +1,90 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Copyright (c) Daniel Sheffield 2022
+All rights reserved.
+-->
+<?xml-stylesheet type="text/xsl" href="pg_view_style.xsl"?>
+<pg_random_view_default_if_null xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="#">
+
+<xsd:schema
+    xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+
+<xsd:simpleType name="UDT.pgdb.pg_catalog.text">
+  <xsd:restriction base="xsd:string">
+  </xsd:restriction>
+</xsd:simpleType>
+
+<xsd:simpleType name="VARCHAR">
+  <xsd:restriction base="xsd:string">
+  </xsd:restriction>
+</xsd:simpleType>
+
+<xsd:complexType name="RowType.pgdb.public.pg_random_view_default_if_null">
+  <xsd:sequence>
+    <xsd:element name="category" type="UDT.pgdb.pg_catalog.text" minOccurs="0"></xsd:element>
+    <xsd:element name="translation" type="VARCHAR" minOccurs="0"></xsd:element>
+    <xsd:element name="reference" type="UDT.pgdb.pg_catalog.text" minOccurs="0"></xsd:element>
+    <xsd:element name="txt" type="VARCHAR" minOccurs="0"></xsd:element>
+  </xsd:sequence>
+</xsd:complexType>
+
+<xsd:complexType name="TableType.pgdb.public.pg_random_view_default_if_null">
+  <xsd:sequence>
+    <xsd:element name="row" type="RowType.pgdb.public.pg_random_view_default_if_null" minOccurs="0" maxOccurs="unbounded"/>
+  </xsd:sequence>
+</xsd:complexType>
+
+<xsd:element name="pg_random_view_default_if_null" type="TableType.pgdb.public.pg_random_view_default_if_null"/>
+
+</xsd:schema>
+
+<row>
+  <category>10_name</category>
+  <translation>KJV</translation>
+  <reference>1 Corinthians 5:7</reference>
+  <txt>Purge out therefore the old leaven, that ye may be a new lump, as ye are unleavened. For even Christ our passover is sacrificed for us:</txt>
+</row>
+
+<row>
+  <category>20_bread</category>
+  <translation>KJV</translation>
+  <reference>2 Corinthians 3:17</reference>
+  <txt>Now the Lord is that Spirit: and where the Spirit of the Lord is, there is liberty.</txt>
+</row>
+
+<row>
+  <category>30_because</category>
+  <translation>MKJV</translation>
+  <reference>Matthew 7:11</reference>
+  <txt>If you then, being evil, know how to give good gifts to your children, how much more shall your Father in Heaven give good things to those who ask Him?</txt>
+</row>
+
+<row>
+  <category>40_debtors</category>
+  <translation>KJV</translation>
+  <reference>1 Peter 1:15</reference>
+  <txt>But as he which hath called you is holy, so be ye holy in all manner of conversation;</txt>
+</row>
+
+<row>
+  <category>50_tempt</category>
+  <translation>ESV</translation>
+  <reference>1 Corinthians 10:13</reference>
+  <txt>No temptation has overtaken you that is not common to man. God is faithful, and he will not let you be tempted beyond your ability, but with the temptation he will also provide the way of escape, that you may be able to endure it.</txt>
+</row>
+
+<row>
+  <category>60_deliver</category>
+  <translation>ESV</translation>
+  <reference>Psalms 107:6</reference>
+  <txt>Then they cried to the Lord in their trouble,   and he delivered them from their distress.</txt>
+</row>
+
+<row>
+  <category>70_glory</category>
+  <translation>MKJV</translation>
+  <reference>Psalms 19:1</reference>
+  <txt>To the Chief Musician. A Psalm of David. The heavens declare the glory of God; and the expanse proclaims His handiwork.</txt>
+</row>
+
+</pg_random_view_default_if_null>

+ 96 - 0
xml/pg_view_style.xsl

@@ -0,0 +1,96 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Copyright (c) Daniel Sheffield 2022
+All rights reserved.
+-->
+<xsl:stylesheet version="1.0"
+    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+    xmlns="http://www.w3.org/1999/xhtml"
+>
+
+  <xsl:output method="xml"
+      doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
+      doctype-public="-//W3C/DTD XHTML 1.0 Strict//EN"
+      indent="yes"/>
+
+  <xsl:template match="/*">
+    <xsl:variable name="schema" select="//xsd:schema"/>
+    <xsl:variable name="tabletypename"
+                  select="$schema/xsd:element[@name=name(current())]/@type"/>
+    <xsl:variable name="rowtypename"
+                  select="$schema/xsd:complexType[@name=$tabletypename]/xsd:sequence/xsd:element[@name='row']/@type"/>
+
+    <html>
+      <head>
+	      <meta name="viewport" content="width=device-width, initial-scale=1"/>
+	      <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/purecss@2.1.0/build/pure-min.css" integrity="sha384-yHIFVG6ClnONEA5yB5DJXfW2/KC173DIQrYoZMEtBvGzmf0PKiGyNEqe9N6BNDBH" crossorigin="anonymous"/>
+	      <link rel="stylesheet" href="https://shandan.one/css/grids-responsive-min.css"/>
+	      <link rel="stylesheet" href="https://shandan.one/css/responsive-visibility-collapse.css"/>
+        <title><xsl:value-of select="name(current())"/></title>
+      </head>
+      <body>
+        <div style="background: darkgray; position: sticky; top: 0; padding: 0.2em; width: 100%; z-index: 1; text-align: center;">
+        <form action="random">
+          <button type="submit">Generate</button>
+	</form>
+        </div>
+        <div style="position: relative; max-width: 68em; min-width: min(100%, 68em); left: 50%; transform: translate(max(-50%, -34em),0)">
+        <table class="pure-table pure-table-bordered pure-table-striped">
+          <tr style="text-transform: capitalize">
+            <xsl:for-each select="$schema/xsd:complexType[@name=$rowtypename]/xsd:sequence/xsd:element/@name">
+                <xsl:variable name="elementtype"
+                              select="."/>
+                <xsl:choose>
+                <xsl:when test="$elementtype = 'txt'">
+              <th class="opt-all">Text</th>
+                </xsl:when>
+                <xsl:when test="$elementtype = 'category'">
+              <th class="opt-all">Section</th>
+                </xsl:when>
+                <xsl:when test="$elementtype = 'translation'">
+              <th class="opt-md opt-lg opt-xl opt-xxl">Reference</th>
+                </xsl:when>
+                <xsl:otherwise>
+                </xsl:otherwise>
+                </xsl:choose>
+            </xsl:for-each>
+          </tr>
+
+          <xsl:for-each select="row">
+            <tr>
+              <xsl:for-each select="*">
+                <xsl:variable name="elementtype"
+                              select="name(current())"/>
+                <xsl:choose>
+                <xsl:when test="$elementtype = 'txt'">
+                <td class="opt-all"><xsl:value-of select="."/></td>
+                </xsl:when>
+                <xsl:when test="$elementtype = 'category'">
+                  <xsl:choose>
+                  <xsl:when test="contains(.,'z_')">
+                  <td class="opt-all" rowspan="2" style="text-transform: capitalize;">Kingdom</td>
+                  </xsl:when>
+                  <xsl:when test="contains(.,'a_')">
+                  </xsl:when>
+		  <xsl:otherwise>
+                  <td class="opt-all" style="text-transform: capitalize;"><xsl:value-of select="."/></td>
+                  </xsl:otherwise>
+                  </xsl:choose>
+                </xsl:when>
+                <xsl:when test="$elementtype = 'translation'">
+                </xsl:when>
+                <xsl:otherwise>
+                <td class="opt-md opt-lg opt-xl opt-xxl" style="line-height: 0.5;"><xsl:value-of select="preceding-sibling::translation"/><p/><xsl:value-of select="translate(translate(.,' ','&#160;'),'-','&#8209;')"/></td>
+                </xsl:otherwise>
+                </xsl:choose>
+              </xsl:for-each>
+            </tr>
+          </xsl:for-each>
+        </table>
+        </div>
+      </body>
+    </html>
+  </xsl:template>
+
+</xsl:stylesheet>