[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Transformation problem tei > xhtml

Subject: Re: Transformation problem tei > xhtml
From: James Fuller <jim.fuller@xxxxxxxxxxxxxx>
Date: Tue, 12 Apr 2005 08:57:33 +0200
coding quote in tei
> In valid XHTML, however, <p> can't contain the equivalent block level
> elements like <blockquote>, <table>, <list>, so the text would need to
> be encoded (3):
>
> <p>Text text text:</p>
>   <blockquote>
>     <p>Quotation quotation quotation.</p>
>   </blockquote>
>  <p>More comment on this quotation.</p>
>   <blockquote>
>      <p>Another long quotation.</p>
>   </blockquote>
>
> The question is, how does one get from the TEI coding (2), where <p>
> can contain 'block level' elements like quote/p, table, and list, to
> the XHTML coding (3), where <p> can't contain block level equivalents
> blockquote/p, table, and ul|ol ?
>

this should do the trick (untested)

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >
   
    <xsl:output method="xhtml" encoding="UTF-8" indent="yes"/>

    <xsl:template match="/">
       
        <!-- Transform TEI -->
        <xsl:variable name="result">
            <xsl:apply-templates select="p"/>
        </xsl:variable>
 
        <!-- Display Results -->
        <xsl:copy-of select="$result"/>
       
    </xsl:template>
   
  <xsl:template match="text()">
        <xsl:if test="normalize-space()">
            <p><xsl:value-of select="normalize-space(.)"/></p>
        </xsl:if>
    </xsl:template>
   
    <xsl:template match="p">
        <xsl:apply-templates/>
    </xsl:template>
   
    <xsl:template match="quote">
        <blockquote>
            <xsl:apply-templates/>
        </blockquote>
    </xsl:template>   
   
</xsl:stylesheet>

> Ideally as another constraint, the first html:p in a sequence like (1)
> should be distinguished from the rest so that one can recognise the
> beginning of a rhetorical paragraph--perhaps by the addition of a
> section number.

you can now take the $result variable and do whatever post processing
you would like....which I leave to you.

gl, Jim Fuller

Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.