|
Subject: Re: [xsl] How to render TEI <div*>s with chapter-like pagination? From: Wendell Piez <wapiez@xxxxxxxxxxxxxxxx> Date: Tue, 15 Apr 2003 11:26:54 -0400 |
Turns out that the above doesn't *quite* work because a div1 may have a sibling that is a div1. Easy enough problem to fix, though, at least by a combination of "for-each" and "if".
<xsl:key name="top-levels-by-div"
match="body/*[not(starts-with(local-name(), div))]"
use="generate-id((preceding-sibling::div|preceding-sibling::div0|preceding-sibling::div1)[last()])"/><xsl:key name="top-levels-by-div"
match="body/*[not(self::div)]"
use="generate-id(preceding-sibling::div[1])"/><xsl:template match="body">
<fo:page-sequence>
<xsl:apply-templates select="key('top-levels-by-div','')"/>
<!-- gets top-level nodes not preceded by a div -->
</fo:page-sequence>
<xsl:apply-templates name="div"/>
</xsl:template><xsl:template match="div">
<fo:page-sequence>
<xsl:apply-templates/>
<!-- invite the kids -->
<xsl:apply-templates select="key('top-levels-by-div', generate-id())"/>
<!-- invite the orphan nodes that directly follow this div -->
</fo:page-sequence>
</xsl:template>Still, I wish I knew why
<xsl:key name="x" match="node()[not(starts-with(name(), div))]" use="generate-id((..|preceding-sibling::div1| preceding-sibling::div2|preceding-sibling::div3)[last()])"/> doesn't work
doesn't work, or why the following doesn't do what the xsl:key line you gave me does:
<xsl:key name="x" match="node()" use="generate-id(..|preceding-sibling::div1[1]| preceding-sibling::div2[1]|preceding-sibling::div3[1])"/>
Cheers, Wendell
====================================================================== Wendell Piez mailto:wapiez@xxxxxxxxxxxxxxxx Mulberry Technologies, Inc. http://www.mulberrytech.com 17 West Jefferson Street Direct Phone: 301/315-9635 Suite 207 Phone: 301/315-9631 Rockville, MD 20850 Fax: 301/315-8285 ---------------------------------------------------------------------- Mulberry Technologies: A Consultancy Specializing in SGML and XML ======================================================================
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| Re: I'm an idiot (was Re: [xsl] How, Wendell Piez | Thread | Re: [xsl] How to render TEI <div*>s, Wendell Piez |
| [xsl] Xalan fillbuf error, Chris Loschen | Date | Re: I'm an idiot (was Re: [xsl] How, Wendell Piez |
| Month |