Wait. You're running xml2info on the mameinfo.xml file, and it's taking
5 seconds to get your output?
If so, you could split mameinfo.xml into smaller chunks - either one per
letter, or put each game's info in a separate xml file. Or use an
intermediate program to weed out the entry/ies you're actually
interested in.
The problem with using xslt to display a single entry in an xml file is
that you have to parse the entire file every time.
[EMAIL PROTECTED] wrote:
Hi,
I'm trying to create my own frontend and stepped over XML and
XSLT...
It all began when I tried to extract the beautiful informations
of mamehistory.dat. Due to the fact that I'm not willing to
parse this file, I found the option to generate a XML file with
xmame just by typing:
xmame.x11 -lx > mameinfo.xml
it results in a _35_ MB file!
So I poked a bit in the net and found a xslt version of xml2info.
According to this, I wrote some lines to get out the history
information of puckman.
But sad thing, it takes nearly 5 secounds - much too long for a
interactive frontend/menu.
A fast feature like:
xmame.x11 -givemehistory puckman
would be very nice.
Should I dig into the source or is there a better way to get
faster results?
Maybe someone here can help me.
******************************
xsltproc history.xslt /usr/local/games/mame/mameinfo.xml
history.xslt:
******************************
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text"/>
<xsl:template match="/">
<xsl:for-each select="mame/game">
<xsl:if test="@name='puckman'">
<xsl:value-of select="history" />
</xsl:if>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
******************************
xsltproc a_bit_faster.xslt /usr/local/games/mame/mameinfo.xml
a_bit_faster.xslt:
******************************
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text"/>
<xsl:template match="/mame/game"></xsl:template>
<xsl:template match="/"><xsl:apply-templates
select="/mame/game"/></xsl:template>
<xsl:template match="/mame/[EMAIL PROTECTED]'puckman']">
<xsl:value-of select="history" />
</xsl:template>
</xsl:stylesheet>
_______________________________________________
Xmame mailing list
Xmame@toybox.twisted.org.uk
http://toybox.twisted.org.uk/mailman/listinfo/xmame
_______________________________________________
Xmame mailing list
Xmame@toybox.twisted.org.uk
http://toybox.twisted.org.uk/mailman/listinfo/xmame