Skip to content

Instantly share code, notes, and snippets.

@eedeebee
Forked from anonymous/gist:460341
Created November 15, 2010 22:34
Show Gist options
  • Save eedeebee/701084 to your computer and use it in GitHub Desktop.
Save eedeebee/701084 to your computer and use it in GitHub Desktop.
xquery version "1.0-ml";
declare default element namespace "http://www.w3.org/1999/xhtml";
let $xslt :=
<xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xpath-default-namespace="http://www.w3.org/1999/xhtml">
<xsl:template match="title">
<h1>
<xsl:apply-templates/>
</h1>
</xsl:template>
<xsl:template match="para">
<p>
<xsl:apply-templates/>
</p>
</xsl:template>
<xsl:template match="sectionTitle">
<h2>
<xsl:apply-templates/>
</h2>
</xsl:template>
<xsl:template match="numbered">
<ol>
<xsl:apply-templates/>
</ol>
</xsl:template>
<xsl:template match="number">
<li>
<xsl:apply-templates/>
</li>
</xsl:template>
</xsl:stylesheet>
let $x :=
<a>
<title>This is a Title</title>
<para>Some words are here.</para>
<sectionTitle>A Section</sectionTitle>
<para>This is a numbered list.</para>
<numbered>
<number>Install MarkLogic Server.</number>
<number>Load content.</number>
<number>Run very big and fast XQuery.</number>
</numbered>
</a>
return
<html xmlns="http://www.w3.org/1999/xhtml">
<head><title>MarkLogic Sample Code</title></head>
<body>{xdmp:xslt-eval($xslt, $x)}</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment