This is the mail archive of the docbook-apps@lists.oasis-open.org mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Customization causing a spurious"Error: no ID for constraint linkend" message


On Sat, Nov 09, 2002 at 12:22:20AM -0600, David Cramer wrote:
> I added the code below to my customization layer to control the keeps and breaks for figures, informalfigures, and screenshots in paras. Now when I have:
> 
> <para> Blah <xref linkend="foo"/>.
> <informalfigure>...</informalfigure>
> </para>
> 
> common.xsl complains "Error: no ID for constraint linkend: foo", even though foo is there and the document processes fine otherwise. Looking at the xsl, a <xsl:variable name="targets" select="key('id',$linkend)"/> (with a corresponding <xsl:key name="id" match="*" use="@id"/> elsewhere) is used to determine check to see if the linkend has a corresponding id, but that should be fine, right? This isn't a big deal, our processing system validates during the build and that catches real errors, so I can just comment out the message, but I was curious about where I'd gone wrong :-)
> 
> Thanks,
> David
> 
>   <xsl:template match="para[informalfigure or figure or screenshot]">
> 	<fo:block xsl:use-attribute-sets="normal.para.spacing">
> 	  <xsl:call-template name="anchor"/>
> 	  <xsl:call-template name="para.figure">
> 		<xsl:with-param name="current.nodeset">
> 		  <xsl:copy-of select="./* | ./text() | ./processing-instruction() | ./comment()"/>
> 		</xsl:with-param>
> 	  </xsl:call-template>
> 	</fo:block>
>   </xsl:template>
> 
>   <xsl:template name="para.figure">
> 
>     <xsl:param name="current.nodeset"/>
> 
>     <xsl:variable name="before.figure">
>       <xsl:for-each select="node()">
> 		<xsl:if test="
> 		  not(self::informalfigure) and 
> 		  not(self::figure) and 
> 		  not(self::screenshot) and 
> 		  not(preceding-sibling::informalfigure) and 
> 		  not(preceding-sibling::figure) and
> 		  not(preceding-sibling::screenshot)">
> 		  <xsl:copy-of select="current()"/>
> 		</xsl:if>
>       </xsl:for-each>
>     </xsl:variable>
> 
>     <xsl:variable name="rest">
>       <xsl:for-each select="$current.nodeset/node()">
> 		<xsl:if test="preceding-sibling::informalfigure or
> 		  preceding-sibling::figure or preceding-sibling::screenshot">
> 		  <xsl:copy-of select="current()"/>
> 		</xsl:if>
>       </xsl:for-each>
>     </xsl:variable>
> 
>     <fo:block><!-- before.figure -->
>       <xsl:apply-templates select="$before.figure/node()"/>
>     </fo:block>
>     <xsl:if test="
> 	  $current.nodeset/informalfigure or
>       $current.nodeset/figure or 
> 	  $current.nodeset/screenshot">
>       <fo:block  
> 		keep-with-previous.within-column="always" 
> 		keep-together.within-column="always"
> 		xsl:use-attribute-sets="normal.para.spacing">
> 		<xsl:apply-templates select="$current.nodeset/informalfigure[
> 	      not(preceding-sibling::figure) and 
> 	      not(preceding-sibling::informalfigure) and
> 		  not(preceding-sibling::screenshot)]"/>
> 		<xsl:apply-templates select="$current.nodeset/figure[
> 	      not(preceding-sibling::figure) and 
> 	      not(preceding-sibling::informalfigure) and
> 		  not(preceding-sibling::screenshot)]"/>
> 		<xsl:apply-templates select="$current.nodeset/screenshot[
> 	      not(preceding-sibling::figure) and 
> 	      not(preceding-sibling::informalfigure) and
> 		  not(preceding-sibling::screenshot)]"/>
>       </fo:block>
>     </xsl:if>
> 
>     <xsl:if test="normalize-space($rest) != ''">
>       <xsl:call-template name="para.figure">
> 		<xsl:with-param name="current.nodeset" select="$rest"/>
>       </xsl:call-template>
>     </xsl:if>
> 
>   </xsl:template>

I'm curious about which processor you use with this.
When I use Saxon 6.5.2 with your code, I get this error:

"Error at xsl:for-each on line 40 of customfo.xsl:
  To use a result tree fragment in a path expression, either
use exslt:node-set() or specify version='1.1'"

I get a similar error in xsltproc when I use the -v option.

The line in question is:

  <xsl:for-each select="$current.nodeset/node()">

Since $current.nodeset is created with a xsl:copy-of, it
is a result tree fragment.  How come your processor doesn't
stumble on this?
-- 

Bob Stayton                                 400 Encinal Street
Publications Architect                      Santa Cruz, CA  95060
Technical Publications                      voice: (831) 427-7796
Caldera International, Inc.                 fax:   (831) 429-1887
                                            email: bobs@caldera.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]