Altova Mailing List Archives>Archive Index >comp.text.xml Archive Home >Recent entries >Thread Prev - Formatting embedded tags >Thread Next - Re: Formatting embedded tags Re: Formatting embedded tagsTo: NULL Date: 12/1/2005 12:21:00 PM > I would like to manipulate the q tags (q stands for quote), getting an
> output like (I'll use my first note as an example):
This is actually easy -- easier, I think, if you make more use of
<xsl:apply-templates/> rather than the <xsl:foreach/> loops you're
currently using.
Have a look at the following stylesheet. I think it will do what you
want.
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:output method="html" version="1.0" encoding="UTF-8"
indent="no" />
<xsl:template match="/">
<html>
<head>
<meta http-equiv="Content-Type"
content="text/html; charset=iso-8859-1" />
<title>Notes</title>
</head>
<body>
<xsl:apply-templates />
</body>
</html>
</xsl:template>
<xsl:template match="text">
<h1>
<xsl:value-of select="@title" />
</h1>
<xsl:apply-templates />
</xsl:template>
<xsl:template match="text/book">
<h2>Book
<xsl:value-of select="@number" /></h2>
<xsl:apply-templates />
</xsl:template>
<xsl:template match="text/book/chapter">
<h3>Chapter
<xsl:value-of select="@number" /></h3>
<xsl:apply-templates />
</xsl:template>
<xsl:template match="note">
- p. <xsl:value-of select="@p" />: <xsl:apply-templates /><br/>
</xsl:template>
<!-- This template matches <q> elements. I've actually just
passed <q> on to the output, since browsers will recognize this as
a quote mark and it can be styled with CSS. -->
<xsl:template match="q">
<q><xsl:apply-templates/></q>
</xsl:template>
</xsl:stylesheet>
-- Lars
--
Lars Kellogg-Stedman <8273grkci8q8kgt@j...>
This email address will expire on 2005-11-23.
| ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
