Re: [xsl] XSLT for XSL-FO internal-destination

Subject: Re: [xsl] XSLT for XSL-FO internal-destination
From: Robert Siebens <telehodown@xxxxxxxxx>
Date: Thu, 19 Nov 2009 18:27:58 -0800 (PST)
David,

Thanks for clarifying that issue with the invalid URI. Also, I am using xslt
1, but it looks like I could use the translate function.

I'm not quite clear on the mechanics of getting the new id for the href into
an FO block at the beginning of each file. Here is a simplified anchor
template. Is this correct method for generating the href id?

<xsl:template match="a|A">
   <fo:inline>
      <fo:basic-link color="blue">
              <xsl:attribute name="internal-destination">
                 <xsl:value-of select="translate(@href,':/','')" />
              </xsl:attribute>
              <xsl:apply-templates />
      </fo:basic-link>
    </fo:inline>
</xsl:template>

Also, I search through a table of contents file to open each source file; so,
I thought I could try inserting the href id in <fo:block> in the page flow,
but this doesn't work:

    <!-- Page sequence for body pages -->
	<fo:page-sequence master-reference="only" format="1">
    	     <fo:static-content flow-name="footer">
                <fo:block text-align="center">
                   <fo:page-number/>
                 </fo:block>
            </fo:static-content>
              <fo:flow flow-name="xsl-region-body">

                   <fo:block id="{@href}">

        			<xsl:for-each select="//TocEntry">
        				<xsl:for-each select="document(@Link)//body">
                			  <xsl:apply-templates/>
        		        </xsl:for-each>
        		     </xsl:for-each>
                   </fo:block>
              </fo:flow>
   </fo:page-sequence>

Can you tell me where I'm going off track?

Thanks,

Rob

--- On Thu, 11/19/09, David Carlisle <davidc@xxxxxxxxx> wrote:

> From: David Carlisle <davidc@xxxxxxxxx>
> Subject: Re: [xsl] XSLT for XSL-FO internal-destination
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Cc: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> Date: Thursday, November 19, 2009, 8:02 PM
>
>
> >  <a href="c:/Help_Files/File_Two.htm">.
>
> not that it matters to xslt but that URI is in error.. If
> browsers
> conformed to the spec that would be a URI using an unknown
> URI
> protocol. "c". should just be href="File_Two.htm" or if you
> need
> absolute uri href="file:///c:/Help_Files/File_Two.htm"
>
> You haven't said if you are using xslt 1 or 2, string
> manipulation is
> easier in 2 but you perhaps dont need any string
> manipulation.
>
>
> > None of the help system files have the filename in the
> <TITLE> or
> > anywhere else in the file, so I'm not able to use the
> > generate-id function to create a target.
>
> not sure why the title being empty affects the use of
> generate-id().
> You could use generate-id() on the document node or the
> empty title
> element, but actually I'd advise against using genereted-id
> for link
> anchors, it makes for very unstable documents, if yu
> regenerate them
> after any sort of edit, or potentially even after no edits,
> all the
> anchors change.
>
> It depends a bit how general you want to be but your
> example would be
> a valid reference if you just wused
> translate(@href,':/','')
> which would make an id of cHelp_FilesFile_Two.htm which you
> could use in
> an fo:simple-link and in an id at the first fo:block that
> you generate
> from a document.
>
> David
>
> ________________________________________________________________________
> The Numerical Algorithms Group Ltd is a company registered
> in England
> and Wales with company number 1249803. The registered
> office is:
> Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United
> Kingdom.
>
> This e-mail has been scanned for all viruses by Star. The
> service is
> powered by MessageLabs.
> ________________________________________________________________________

Current Thread