Skip to content

Instantly share code, notes, and snippets.

@ColinMaudry
Last active August 29, 2015 14:22
Show Gist options
  • Save ColinMaudry/fa98abff82521d135ec7 to your computer and use it in GitHub Desktop.
Save ColinMaudry/fa98abff82521d135ec7 to your computer and use it in GitHub Desktop.
Testing XSLT priority
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE topic PUBLIC "-//OASIS//DTD DITA Topic//EN" "dtd/technicalContent/dtd/topic.dtd">
<topic class=" topic/topic " id="mytopic">
<title class=" topic/title">Stairway to heaven</title>
<body class=" topic/body">
<p class=" topic/p">There's a lady who's sure, <b outputclass="strong" class=" topic/ph hi-d/b">all</b> that glitters is gold.</p>
</body>
</topic>
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template name="A" match="*[contains(@class, ' topic/ph ')]">
aaa
</xsl:template>
<xsl:template name="B" match="p/b[contains(@class, ' hi-d/b ')]">
bbb
</xsl:template>
<xsl:template name="C" match="p/b">
ccc
</xsl:template>
<xsl:template name="D" match="p/*">
ddd
</xsl:template>
<xsl:template name="E" match="/topic/body/p/b">
eee
</xsl:template>
<xsl:template name="F" match="p/b[. = 'all']">
fff
</xsl:template>
<xsl:template name="G" match="b[@outputclass != 'weak']">
ggg
</xsl:template>
<xsl:template name="H" match="b">
hhh
</xsl:template>
</xsl:stylesheet>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment