Add some example XSLTs that operate on -listxml output

This commit is contained in:
Vas Crabb 2019-01-03 03:38:25 +11:00
parent 9a8d3c56ce
commit 5e75e186e0
3 changed files with 136 additions and 0 deletions

View File

@ -0,0 +1,43 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Prints BIOS options for machines and devices that have them.
$ ./mame64d -listxml osborne1 saturn | xsltproc scripts/xslt/list-bios.xslt -
osborne1 Osborne-1
vera BIOS version A
ver12 BIOS version 1.2
ver121 BIOS version 1.2.1
ver13 BIOS version 1.3
ver14 BIOS version 1.4
ver143 BIOS version 1.43
*ver144 BIOS version 1.44
saturn Saturn (USA)
101a Overseas v1.01a (941115)
100a Overseas v1.00a (941115)
satcdb Saturn CDB (CD Block)
*cdb106 Saturn CD Block 1.06
cdb105 Saturn CD Block 1.05
ygr022 Saturn CD Block (YGR022 315-5962)
ie15_terminal IE15 Terminal
*5chip 5-chip firmware (newer)
6chip 6-chip firmware (older)
-->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text" omit-xml-declaration="yes" indent="no" />
<xsl:template match="/">
<xsl:for-each select="mame/machine[biosset]">
<xsl:value-of select="concat(substring(concat(@name, ' '), 1, 16), ' ' , description, '&#xA;')" />
<xsl:for-each select="biosset">
<xsl:choose>
<xsl:when test="@default='yes'">
<xsl:value-of select="' *'" />
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="' '" />
</xsl:otherwise>
</xsl:choose>
<xsl:value-of select="concat(substring(concat(@name, ' '), 1, 16), ' ' , @description, '&#xA;')" />
</xsl:for-each>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>

View File

@ -0,0 +1,48 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Prints a tree of runnable machines, excluding non-runnable devices.
Clones are indented below parents. May be slow for full builds.
$ ./build/linux_clang/bin/x64/Debug/test64d -listxml | xsltproc scripts/xslt/list-runnable-tree.xslt -
bluehawk Blue Hawk
bluehawkn Blue Hawk (NTC)
flytiger Flying Tiger (set 1)
flytigera Flying Tiger (set 2)
gulfstrm Gulf Storm (set 1)
gulfstrma Gulf Storm (set 2)
gulfstrmb Gulf Storm (set 3)
gulfstrmk Gulf Storm (Korea)
gulfstrmm Gulf Storm (Media Shoji)
gundl94 Gun Dealer '94
primella Primella
intlc44 INTELLEC 4/MOD 4
intlc440 INTELLEC 4/MOD 40
lastday The Last Day (set 1)
ddaydoo Chulgyeok D-Day (Korea)
lastdaya The Last Day (set 2)
pollux Pollux (set 1)
polluxa Pollux (set 2)
polluxa2 Pollux (set 3)
polluxn Pollux (Japan, NTC license, distributed by Atlus)
popbingo Pop Bingo
rshark R-Shark
sadari Sadari
superx Super-X (NTC)
superxm Super-X (Mitchell)
thehand The Hand
gotya Got-Ya (12/24/1981)
whousetc Test Console Serial #5
-->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text" omit-xml-declaration="yes" indent="no" />
<xsl:template match="/">
<xsl:for-each select="mame/machine[(@runnable!='no') and not(@cloneof)]">
<xsl:variable name="parent" select="@name" />
<xsl:value-of select="concat(substring(concat(@name, ' '), 1, 16), ' ' , description, '&#xA;')" />
<xsl:for-each select="../machine[(@runnable!='no') and (@cloneof=$parent)]">
<xsl:value-of select="concat(' ', substring(concat(@name, ' '), 1, 16), ' ' , description, '&#xA;')" />
</xsl:for-each>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>

View File

@ -0,0 +1,45 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Prints a table of runnable machines, excluding non-runnable devices.
Useful for finding out exactly what systems are available in a custom
subtarget build using a small selection of driver sources.
$ ./build/linux_clang/bin/x64/Debug/test64d -listxml | xsltproc scripts/xslt/list-runnable.xslt -
bluehawk Blue Hawk
bluehawkn Blue Hawk (NTC)
ddaydoo Chulgyeok D-Day (Korea)
flytiger Flying Tiger (set 1)
flytigera Flying Tiger (set 2)
gotya Got-Ya (12/24/1981)
gulfstrm Gulf Storm (set 1)
gulfstrma Gulf Storm (set 2)
gulfstrmb Gulf Storm (set 3)
gulfstrmk Gulf Storm (Korea)
gulfstrmm Gulf Storm (Media Shoji)
gundl94 Gun Dealer '94
intlc44 INTELLEC 4/MOD 4
intlc440 INTELLEC 4/MOD 40
lastday The Last Day (set 1)
lastdaya The Last Day (set 2)
pollux Pollux (set 1)
polluxa Pollux (set 2)
polluxa2 Pollux (set 3)
polluxn Pollux (Japan, NTC license, distributed by Atlus)
popbingo Pop Bingo
primella Primella
rshark R-Shark
sadari Sadari
superx Super-X (NTC)
superxm Super-X (Mitchell)
thehand The Hand
whousetc Test Console Serial #5
-->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text" omit-xml-declaration="yes" indent="no" />
<xsl:template match="/">
<xsl:for-each select="mame/machine[@runnable!='no']">
<xsl:value-of select="concat(substring(concat(@name, ' '), 1, 16), ' ' , description, '&#xA;')" />
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>