# HG changeset patch # User František Kučera <franta-hg@frantovo.cz> # Date 1543713503 -3600 # Node ID d248aa5da0381b95a79ff86dd34d9e042d67eed5 # Parent 793aedbbe1c3d2f5f5145226d7391ed95a384a93 macro for escaping XML using sed in scripts diff -r 793aedbbe1c3 -r d248aa5da038 relpipe-data/makra/escape-xml.xsl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/relpipe-data/makra/escape-xml.xsl Sun Dec 02 02:18:23 2018 +0100 @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="UTF-8"?> +<xsl:stylesheet version="2.0" + xmlns="http://www.w3.org/1999/xhtml" + xmlns:h="http://www.w3.org/1999/xhtml" + xmlns:s="https://trac.frantovo.cz/xml-web-generator/wiki/xmlns/strana" + xmlns:k="https://trac.frantovo.cz/xml-web-generator/wiki/xmlns/konfigurace" + xmlns:m="https://trac.frantovo.cz/xml-web-generator/wiki/xmlns/makro" + xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:fn="http://www.w3.org/2005/xpath-functions" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns:xs="http://www.w3.org/2001/XMLSchema" + exclude-result-prefixes="fn h s k m xs"> + + <!-- + Should be used as a pipe filter in scripts with výstup="xhtml" + --> + <xsl:template match="m:escape-xml"><![CDATA[sed -e 's/&/\&/g' -e 's/</\</g' -e 's/>/\>/g' -e 's/"/\"/g' -e "s/'/\\'/g"]]></xsl:template> + +</xsl:stylesheet> +