Skip to content

Instantly share code, notes, and snippets.

@vincentml
vincentml / formatter.xsl
Created August 4, 2023 17:12
XML Formatter
<?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:xd="http://www.oxygenxml.com/ns/doc/xsl"
xmlns:this="formatter"
exclude-result-prefixes="xs xd this"
expand-text="true"
version="3.0">
<xd:doc scope="stylesheet">
<xd:desc>
@vincentml
vincentml / exist-db service install.md
Last active December 12, 2022 18:57
eXist-db scripts to install and run eXist-db as a service on Windows operating systems.

eXist-db scripts to install and run eXist-db as a service on Windows operating systems.

These scripts should be placed in the "bin" folder of eXsit-db, for example after downloading and unzipping exist-distribution-6.0.1-win.zip from GitHub.

@vincentml
vincentml / XmlCharacterEncodingValidation.md
Last active May 14, 2019 06:33
XML Character Encoding Validation

XML Character Encoding Validation

The character encoding of an XML file should be validated to ensure that the text within the XML file can be correctly displayed or read by systems without any "broken character" problems. The ideal method for validating the character encoding of an XML file is a 2 step process.

  1. First, the XML file can be checked to ensure that it contains only byte sequences that are valid Unicode. This is fairly straightforward and there are libraries available to check Unicode encoding of any text file, which can be applied to XML file because XML is essentially text.
  2. Second, after the XML file has been parsed check that the text nodes and attribute values contain only valid Unicode characters. This can be done using using regular expressions in XPath, Schematron, XQuery, Java, etc.

The XML Recommendation specifies that XML should be encoded using Unicode character set. Some XML parsers might reject an XML file that contains byte sequences that are not valid Unicode, however tho

@vincentml
vincentml / wp-updates.xsl
Last active May 20, 2018 18:32
WordPress Updates page convert to Excel using XSLT
<?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:math="http://www.w3.org/2005/xpath-functions/math"
xmlns:xd="http://www.oxygenxml.com/ns/doc/xsl" exclude-result-prefixes="xs math xd"
expand-text="yes" version="3.0">
<xd:doc scope="stylesheet">
<xd:desc>
<xd:p>This XSLT parses the text of the WordPress Updates page into an easier to use
format which can be opened in Excel. When updating WordPress it is good practice to
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE article SYSTEM "../schemas/JATS-Archiving-1-1-OASIS-MathML3-DTD/JATS-archive-oasis-article1-mathml3.dtd">
<article>
<front>
<article-meta>
<article-id pub-id-type="doi">10.0000/example</article-id>
<article-version article-version-type="version-of-record">
<article-version article-version-type="submitted-manuscript-under-review">
<article-version article-version-type="authors-original">
<date>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE article SYSTEM "../schemas/JATS-Archiving-1-1-OASIS-MathML3-DTD/JATS-archive-oasis-article1-mathml3.dtd">
<article>
<front>
<article-meta>
<article-id pub-id-type="doi">10.0000/example</article-id>
<article-version article-version-type="accepted-manuscript">
<date>
<day>27</day>
<month>7</month>
@vincentml
vincentml / throttle.xqm
Created February 5, 2016 01:34
Throttle pause for BaseX
(:~ Throttling module for BaseX
:
: Only one method for now, may add alterate throttling methods in future.
:
:)
module namespace _ = "throttle";
declare namespace store = 'java.util.HashMap';