Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: Formatting embedded tags

From: Lars Kellogg-Stedman <8273grkci8q8kgt@-------.--->
To: 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.



transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent