|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: following-sibling problem
Thanks Joe,
On Nov 2, 2004, at 10:28 AM, Joe Heidenreich wrote: It seems the reason your process-level isn't returning any <li> tags is because there isn't a level 3. What's happening is you are outputting the <ul> before checking to see whether there is a value.
Alas the below doesn't quite work. Besides needing to change the "<" to "<", my level 2 bullets aren't getting applied now. I think what you want to do is check to see if: Here's the complete stylesheet: === <?xml version='1.0' encoding='utf-8'?> <xsl:stylesheet version='2.0' xmlns:xsl='http://www.w3.org/1999/XSL/Transform' xmlns:key="http://developer.apple.com/schemas/APXL" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://www.w3.org/1999/xhtml" xmlns:xhtml="http://www.w3.org/1999/xhtml" exclude-result-prefixes="key xhtml"> <!-- A simple XSLT convert Apple Keynote presentation files to S5, the XHTML-based slideshow system from Eric Meyer. Because of limitations in the Keynote file format, I have relied on the new grouping functionality in XSLT 2.0. As such, you should use Saxon 8 to run it. --> <xsl:output method="xhtml" version="1.0" encoding="utf-8" indent="yes"/>
<xsl:strip-space elements="*"/>
<xsl:param name="venue"/>
<xsl:variable name="title"
select="//key:slide[@master-slide-id='master-slide-1']/key:bullets/
key:bullet[@level='0']"/>
<xsl:variable name="author">Bruce DArcus</xsl:variable>
<xsl:template match="/">
<html>
<head>
<title>
<xsl:value-of select="$title"/>
</title>
<link rel="stylesheet" href="ui/slides.css" type="text/css"
media="screen" id="slideProj" />
<link rel="stylesheet" href="ui/opera.css" type="text/css"
media="projection" id="operaFix" />
<link rel="stylesheet" href="ui/print.css" type="text/css"
media="print" id="slidePrint" />
<script src="ui/slides.js" type="text/javascript"></script>
</head>
<body>
<div class="layout">
<div id="currentSlide"><xsl:text> </xsl:text></div>
<div id="header"><xsl:text> </xsl:text></div>
<div id="footer">
<h1><xsl:value-of select="$venue"/></h1>
<h2><xsl:value-of select="$title"/></h2>
<div id="controls"><xsl:text> </xsl:text></div>
</div>
</div> <div class="presentation">
<xsl:apply-templates select="//key:slide"/>
</div>
</body>
</html>
</xsl:template>
<xsl:template match="key:bullets">
<xsl:choose>
<xsl:when test="../@master-slide-id='master-slide-1'">
<xsl:apply-templates select="key:bullet[@level='0']"
mode="title"/>
</xsl:when>
<xsl:otherwise>
<h2><xsl:value-of select="key:bullet[@level='0']"/></h2>
<ul>
<xsl:call-template name="process-level">
<xsl:with-param name="bullet" select="key:bullet"/>
<xsl:with-param name="level" select="1"/>
</xsl:call-template>
</ul>
</xsl:otherwise>
</xsl:choose>
</xsl:template><xsl:template match="key:drawables/key:image[contains(@image-data,
'.jpg')]|
key:drawables/key:image[contains(@image-data, '.png')]">
<div class="image">
<img src="{@image-data}"/>
</div>
</xsl:template><xsl:template match="key:bullet[@level='0']" mode="title"> <h1><xsl:value-of select="$title"/></h1> <h3><xsl:value-of select="$author"/></h3> </xsl:template> <xsl:template name="process-level">
<xsl:param name="bullet" required="yes" as="element()*"/>
<xsl:param name="level" required="yes" as="xs:integer"/>
<xsl:for-each-group select="$bullet[not(@level='0')]"
group-starting-with="*[xs:integer(@level) eq $level]">
<li><xsl:value-of select="normalize-space(.)"/>
<xsl:if test="@level < following-sibling::bullet[@level][1]">
<ul>
<xsl:call-template name="process-level">
<xsl:with-param name="bullet" select="current-group()
except ."/>
<xsl:with-param name="level" select="$level + 1"/>
</xsl:call-template>
</ul>
</xsl:if>
</li>
</xsl:for-each-group>
</xsl:template></xsl:stylesheet> === Bruce
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








