jefft 2003/04/02 05:54:22
Modified: . status.xml
src/resources/stylesheets site2book.xsl
Log:
- Saner heuristic for determining when something is a menu or menu-item. Fixes
bug where links with #'s in them aren't displayed
- Experiments with allowing @description in site.xml
Revision Changes Path
1.142 +3 -0 xml-forrest/status.xml
Index: status.xml
===================================================================
RCS file: /home/cvs/xml-forrest/status.xml,v
retrieving revision 1.141
retrieving revision 1.142
diff -u -r1.141 -r1.142
--- status.xml 27 Mar 2003 03:53:46 -0000 1.141
+++ status.xml 2 Apr 2003 13:54:21 -0000 1.142
@@ -24,6 +24,9 @@
<changes>
<release version="0.5-dev" date="unreleased">
+ <action dev="JT" type="fix" context="skins">
+ Fix menu bug where links with #fragment identifiers wouldn't display.
+ </action>
<action dev="JT" type="fix" context="core">
Get images in PDFs working with FOP 0.20.x. This requires the user to
download jimi.jar from <link
1.3 +27 -10 xml-forrest/src/resources/stylesheets/site2book.xsl
Index: site2book.xsl
===================================================================
RCS file: /home/cvs/xml-forrest/src/resources/stylesheets/site2book.xsl,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- site2book.xsl 8 Jan 2003 05:44:34 -0000 1.2
+++ site2book.xsl 2 Apr 2003 13:54:21 -0000 1.3
@@ -25,22 +25,39 @@
<xsl:template match="*/*">
<xsl:choose>
- <xsl:when test="contains(@href, '#') or not(@label)">
+ <!-- No label, abandon the whole subtree -->
+ <xsl:when test="not(@label)">
</xsl:when>
+ <!-- Below here, everything has a label, and is therefore considered "for display"
-->
- <xsl:when test="not(contains(@href, '#')) and count(*) = 0
- or count(*) > 0 and contains(*/@href, '#')">
- <menu-item label="{@label}" href="{@href}"/>
+ <!-- No children -> must be a menu item -->
+ <!-- Has children, but they are not for display -> menu item -->
+ <xsl:when test="count(*) = 0 or count(*) > 0 and (not(*/@label))">
+ <menu-item label="{@label}" href="{@href}">
+ <xsl:if test="@description">
+ <xsl:attribute name="description">
+ <xsl:value-of select="@description"/>
+ </xsl:attribute>
+ </xsl:if>
+ </menu-item>
</xsl:when>
- <xsl:when test="not(@href) or substring(@href, string-length(@href)) = '/'">
+
+ <!-- Anything else is considered a menu -->
+ <xsl:otherwise>
<menu label="{@label}">
+ <xsl:if test="@href">
+ <xsl:attribute name="href">
+ <xsl:value-of select="@href"/>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:if test="@description">
+ <xsl:attribute name="description">
+ <xsl:value-of select="@description"/>
+ </xsl:attribute>
+ </xsl:if>
+
<xsl:apply-templates/>
</menu>
- </xsl:when>
- <xsl:otherwise>
- <unknown label="{@label}">
- <xsl:apply-templates/>
- </unknown>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
|