gimp-help-2 r2316 - in trunk: . stylesheets
- From: ulfehlert svn gnome org
- To: svn-commits-list gnome org
- Subject: gimp-help-2 r2316 - in trunk: . stylesheets
- Date: Mon, 21 Jan 2008 16:11:15 +0000 (GMT)
Author: ulfehlert
Date: Mon Jan 21 16:11:15 2008
New Revision: 2316
URL: http://svn.gnome.org/viewvc/gimp-help-2?rev=2316&view=rev
Log:
2008-01-21 Ulf-D. Ehlert <ulfehlert svn gnome org>
* stylesheets/makeindex.xsl: started to fix stylesheet:
for the 'obj' elements (corresponding to valid help-ids?),
- the correct "targetptr" attribute is added so that the
help entry is sorted into the tree view of the
GIMP help browser,
- a title will be added if possible.
Try e.g. "make html/de/gimp-help.xml
XSLTFLAGS='--stringparam obj.missing.title.warning 1
--stringparam obj.title.debug 1 --nonet'"
to see how/if it works.
Modified:
trunk/ChangeLog
trunk/stylesheets/makeindex.xsl
Modified: trunk/stylesheets/makeindex.xsl
==============================================================================
--- trunk/stylesheets/makeindex.xsl (original)
+++ trunk/stylesheets/makeindex.xsl Mon Jan 21 16:11:15 2008
@@ -1,10 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
-<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- xmlns:doc="http://nwalsh.com/xsl/documentation/1.0"
- exclude-result-prefixes="doc" version="1.0">
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="xml" encoding="UTF-8" indent="yes" />
+ <xsl:param name="obj.missing.title.warning" select="0"/>
+ <xsl:param name="obj.title.debug" select="0"/>
+
<xsl:template match="/">
<gimp-help>
<xsl:apply-templates select="*" />
@@ -19,7 +20,7 @@
</help-missing>
</xsl:template>
- <xsl:template match="div|ttl">
+ <xsl:template match="div">
<xsl:choose>
<xsl:when test="@targetptr">
<help-item>
@@ -49,22 +50,76 @@
<xsl:apply-templates select="*" />
</xsl:template>
- <xsl:template match="obj|ttl">
- <xsl:choose>
- <xsl:when test="@targetptr">
- <help-item>
- <xsl:attribute name="id">
- <xsl:value-of select="@targetptr" />
- </xsl:attribute>
- <xsl:attribute name="ref">
- <xsl:value-of select="@href" />
- </xsl:attribute>
- <xsl:attribute name="parent">
- <xsl:value-of select="../@targetptr" />
- </xsl:attribute>
- </help-item>
- </xsl:when>
- </xsl:choose>
+ <xsl:template match="obj">
+ <xsl:if test="@targetptr and starts-with(@targetptr, 'gimp-')
+ and not(@element = 'footnote')
+ and not(@element = 'figure')">
+ <help-item>
+ <xsl:attribute name="id">
+ <xsl:value-of select="@targetptr" />
+ </xsl:attribute>
+ <xsl:attribute name="ref">
+ <xsl:value-of select="@href" />
+ </xsl:attribute>
+ <xsl:attribute name="title">
+ <xsl:choose>
+ <xsl:when test="not(contains(ttl, '???')) and normalize-space(ttl) != ''">
+ <!-- case 1: "obj" has "ttl" (title) attribute -->
+ <xsl:value-of select="concat('(', normalize-space(ttl), ')')" />
+ <xsl:if test="$obj.title.debug = 1">
+ <xsl:message>
+ <xsl:text>Debug: GIMP help browser title (ttl) = </xsl:text>
+ <xsl:value-of select="concat('(', normalize-space(ttl), ')')" />
+ </xsl:message>
+ </xsl:if>
+ </xsl:when>
+ <xsl:otherwise> <!-- "obj" without "ttl" attribute -->
+ <xsl:variable name="xreftext.normalized">
+ <xsl:if test="not(contains(xreftext,'???'))">
+ <xsl:value-of select="normalize-space(xreftext)"/>
+ </xsl:if>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="$xreftext.normalized != ''">
+ <!-- case 3: "obj" has "xreftext" attribute -->
+ <xsl:value-of select="$xreftext.normalized" />
+ <xsl:value-of select="concat('(', $xreftext.normalized, ')')" />
+ <xsl:if test="$obj.title.debug = 1">
+ <xsl:message>
+ <xsl:text>Debug: GIMP help browser title (xreftext) = </xsl:text>
+ <xsl:value-of select="concat('(', $xreftext.normalized, ')')" />
+ </xsl:message>
+ </xsl:if>
+ </xsl:when>
+ <xsl:otherwise>
+ <!-- case 4: "obj" has no "ttl" or "xreftext" attribute -->
+ <xsl:value-of select="concat('FIXME TITLE: ', @targetptr)" />
+ <xsl:if test="$obj.missing.title.warning = 1">
+ <xsl:message>
+ <xsl:text>Warning: </xsl:text>
+ <xsl:text>No GIMP help browser title for </xsl:text>
+ <xsl:value-of select="@element" />
+ <xsl:text> </xsl:text>
+ <xsl:value-of select="@targetptr" />
+ </xsl:message>
+ </xsl:if>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:otherwise> <!--end of "obj without ttl"-->
+ </xsl:choose>
+ </xsl:attribute> <!--title-->
+ <xsl:attribute name="parent">
+ <xsl:choose>
+ <xsl:when test="../@targetptr">
+ <xsl:value-of select="../@targetptr" />
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="../../@targetptr" />
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:attribute>
+ </help-item>
+ </xsl:if>
<xsl:apply-templates select="*" />
</xsl:template>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]