X hits on this document

424 views

0 shares

1 downloads

0 comments

51 / 142

Transforming XML with XSLT

<!-- catalog --> <xsl:template match="catalog"> <html> <head> <title><xsl:value-of select="caption"/></title> </head> <body> <table> <xsl:apply-templates select="caption"/> <xsl:apply-templates select="structure"/> <xsl:apply-templates select="work"/> </table> </body> </html> </xsl:template>

<!-- caption --> <xsl:template match="caption">

<caption style="text-align: center; margin-bottom: 1em"> <xsl:value-of select="."/> </caption> </xsl:template>

<!-- structure --> <xsl:template match="structure">

<thead style="font-weight: bold"> <tr><xsl:apply-templates/></tr> </thead> </xsl:template>

<!-- work --> <xsl:template match="work">

<tr><xsl:apply-templates/></tr> </xsl:template>

<!-- title --> <xsl:template match="title">

<td style="text-align: right; padding: 3px"><xsl:value-of select="."/></td> </xsl:template>

<!-- author, type, or date --> <xsl:template match="author | type | date">

<td><xsl:value-of select="."/></td> </xsl:template>

</xsl:stylesheet>

Again, the end result should look something like this:

43

Document info
Document views424
Page views430
Page last viewedWed Dec 07 11:34:09 UTC 2016
Pages142
Paragraphs3126
Words34660

Comments