Skip to content

Instantly share code, notes, and snippets.

@prettydiff
Created November 24, 2021 21:50
Show Gist options
  • Save prettydiff/973871a8d52becb436911f7827a63d8c to your computer and use it in GitHub Desktop.
Save prettydiff/973871a8d52becb436911f7827a63d8c to your computer and use it in GitHub Desktop.
xml parser
var parser = new DOMParser(),
xml=parser.parseFromString(`<xsl:stylesheet
version = "1.0"
xmlns:xsl = "http://www.w3.org/1999/XSL/Transform"
xmlns:date = "http://exslt.org/dates-and-times"
xmlns:exsl = "http://exslt.org/common"
xmlns:str = "http://exslt.org/strings"
extension-element-prefixes = "date exsl">
<xsl:output
version = "1.0"
method = "html"
indent = "yes"
standalone = "yes"
encoding = "UTF-8"
/>
<xsl:strip-space elements="*"/>
<xsl:template match="/">
<html>
<head>
<title>xhtml test</title>
<style>
<xsl:text disable-output-escaping="yes">
@import url("common.css" ) screen;
@import url("modern.css" ) screen;
@import url("classic.css") screen;
</xsl:text>
</style>
</head>
<body>
<div id="container">
<xsl:text disable-output-escaping="yes">
<![CDATA[
<?php
$cnt = 1;
?>
]]>
</xsl:text>
<xsl:copy>
<xsl:apply-templates select="/*"/>
</xsl:copy>
</div>
</body>
</html>
</xsl:template>
<xsl:template match="/*">
<div id="header">
Projekt: dBase4web 1.0.0 (c) 2021 Jens Kallup
<hr></hr>
</div>
<div>
<h3>Überblick</h3>
<xsl:for-each select="/doxygen/compounddef">
<xsl:value-of select="str:replace(compoundname,'kallup::webapp::v000001::','')"/><br></br>
<div class="members">
<xsl:for-each select="./sectiondef/memberdef">
<div class="memberItem">
<xsl:if test="@kind='variable'">
<xsl:variable name="topic" select="@id"></xsl:variable>
<div class="classVariable">
<div class="memberVariable">
Variable
</div>
<div class="memberLink">
<a href="#{$topic}"><xsl:value-of select="name"/></a>
</div>
<div class="memberDetails">
<a href="#{$topic}">Details ...</a>
</div>
<div class="memberType">
<xsl:value-of select="type"/>
<xsl:text disable-output-escaping="yes">
<![CDATA[ &nbsp; ]]>
</xsl:text>
</div>
<div class="memberInitValue">
<xsl:value-of select="initializer"/>
<xsl:text disable-output-escaping="yes">
<![CDATA[ &nbsp; ]]>
</xsl:text>
</div>
<div class="memberBriefDescription">
<xsl:text disable-output-escaping="yes">
<![CDATA[
<table border="0">
<tr>
<td>
]]>
</xsl:text>
<xsl:value-of select="briefdescription"/>
<xsl:text disable-output-escaping="yes">
<![CDATA[
&nbsp;
</td>
</tr>
</table>
]]>
</xsl:text>
</div>
<xsl:if test="string-length(initializer) > 15">
<div class="nullText">
<xsl:text disable-output-escaping="yes">
<![CDATA[ &nbsp; ]]>
</xsl:text>
</div>
</xsl:if>
</div>
</xsl:if>
</div>
</xsl:for-each>
</div>
</xsl:for-each>
<hr></hr>
</div>
<div>
<h3 class="sumDescription">Beschreibung</h3>
<xsl:for-each select="/doxygen/compounddef">
<xsl:for-each select="./sectiondef/memberdef">
<xsl:variable name="topic" select="@id"></xsl:variable>
<xsl:if test="@kind='variable'">
<div class="memberVariableSum">
Variable
</div>
</xsl:if>
<xsl:if test="@kind='function'">
<div class="memberVariableSum">
Funktion
</div>
</xsl:if>
<div>
<h3><a name="{$topic}"><xsl:value-of select="name"/></a></h3>
<xsl:for-each select="detaileddescription">
<!--xsl:if test="simplesect[@kind='note']"-->
pupulo<p>ss</p>
<h2><xsl:value-of select="simplesect"/></h2>
<!--/xsl:if-->
</xsl:for-each>
<hr></hr>
</div>
</xsl:for-each>
</xsl:for-each>
</div>
<div id="footer">
<hr></hr>
Erstellt mit doxygen: <xsl:value-of select="@version"/><br></br>
am: <xsl:value-of select="$date"/><br></br>
Sprache: <xsl:value-of select="compounddef/@language"/>
</div>
</xsl:template>
</xsl:stylesheet>`,"application/xml");
xml.getElementsByTagName("xsl:for-each");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment