Subject: Re: chords and lyrics notations via XSL From: Jakub Skopal <jakubs@xxxxxxxxxxx> Date: Mon, 8 Nov 1999 01:12:10 +0100 |
Hi, well, I looked more deeply at xslt and did this: source: <song> <head> <title>The winner takes it all</title> </head> <body> <line> <chord value=" "/>I don't wanna <chord value="Gb7"/>talk about things we've <chord value="Db/F"/>gone trough, though it's hurting <chord value="Dbm/Eb"/>me, now it's histo<chord value="Db"/>ry. </line> </body> </song> xsl: <xsl:stylesheet xmlns:xsl="http://www.w3.org/XSL/Transform/1.0"> <xsl:template match="song"> <xsl:processing-instruction name="cocoon-format">type="text/html"</xsl:processing-instruction> <html> <xsl:apply-templates/> </html> </xsl:template> <xsl:template match="head"> <head> <title><xsl:value-of select="title"/></title> </head> </xsl:template> <xsl:template match="body"> <body> <h1> <xsl:value-of select="/song/head/title"/> </h1> <xsl:apply-templates/> </body> </xsl:template> <xsl:template match="line"> <table cellpadding="0" cellspacing="0"> <tr> <xsl:apply-templates select="chord"/> </tr> <tr> <xsl:apply-templates mode="lyrics"/> </tr> </table> </xsl:template> <xsl:template match="chord"> <td><font size="-1"><b> <xsl:value-of select="@value"/> </b></font></td> </xsl:template> <xsl:template match="text()" mode="lyrics"> <td> <xsl:value-of select="."/> </td> </xsl:template> </xsl:stylesheet> which produces quite reasonable output (read: which produces the think I wanted :-))) The same think, I'd say, could be realized with fo's, but I don't know any parser :-(( It's more straightforward than I thought it would be... I decided to use cocoon's producer ability to implement the automatic transposition in Java... I think it's not what XSLT is here for. what i'd like to ask, whether somebody has an idea about how to do such things as: "replace all occurences of 'b' in string with '<sup>b</sup>'" to automatically render Db into D<sup>b</sup>... I tried to implement this for more than two hours but found no way :-( (of course except a giant <xsl:choose> with all possible chord values enumerated...) Jakub P.S. the produced HTML result is: <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/RED-html40/strict.dtd"> <html><head><title>The winner takes it all</title></head><body><h1>The winner takes it all</h1><table cellpadding="0" cellspacing="0"><tr><td><font size="-1"><b> </b></font></td><td><font size="-1"><b>Gb7</b></font></td><td><font size="-1"><b>Db/F</b></font></td><td><font size="-1"><b>Dbm/Eb</b></font></td><td><font size="-1"><b>Db</b></font></td></tr><tr><td>I don't wanna </td><td>talk about things we've </td><td>gone trough, though it's hurting </td><td>me, now it's histo</td><td>ry. </td></tr></table></body></html> <!-- This page was served in 2187 milliseconds by Cocoon 1.5 --> -- Jakub "RiffRaff" Skopal mailto:j@xxxxxxx XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
RE: chords and lyrics notations via, Mark Hayes | Thread | Re: chords and lyrics notations via, Lee Anne Phillips |
RE: chords and lyrics notations via, Paul Tyng | Date | Re: chords and lyrics notations via, Lee Anne Phillips |
Month |