forrest-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Robert Koberg" <...@koberg.com>
Subject RE: suggestion for dtd
Date Wed, 06 Nov 2002 15:52:19 GMT
Here is one I use to 'fix quotes' - I will get to this soon (today?) if you want
to wait.  Otherwise check this out and it should give you some ideas:

<?xml version="1.0" encoding="iso-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:template name="fix_quotes">
   <xsl:param name="string"/>

   <xsl:choose>
     <xsl:when test="contains($string, &quot;'&quot;)">
       <xsl:value-of
         select="substring-before($string, &quot;'&quot;)"/>
       <xsl:text>\'</xsl:text>
       <xsl:call-template name="fix_quotes">
         <xsl:with-param name="string"
           select="substring-after($string, &quot;'&quot;)"/>
       </xsl:call-template>
     </xsl:when>
     <xsl:otherwise>
       <xsl:value-of select="$string"/>
     </xsl:otherwise>
   </xsl:choose>

</xsl:template>

<xsl:template name="remove_quotes">
   <xsl:param name="string"/>

   <xsl:choose>
     <xsl:when test="contains($string, &quot;'&quot;)">
       <xsl:value-of
         select="substring-before($string, &quot;'&quot;)"/>
       <xsl:call-template name="remove_quotes">
         <xsl:with-param name="string"
           select="substring-after($string, &quot;'&quot;)"/>
       </xsl:call-template>
     </xsl:when>
     <xsl:otherwise>
       <xsl:value-of select="$string"/>
     </xsl:otherwise>
   </xsl:choose>

</xsl:template>

</xsl:stylesheet>

> -----Original Message-----
> From: Jeff Turner [mailto:jefft@apache.org]
> Sent: Wednesday, November 06, 2002 7:56 AM
> To: forrest-dev@xml.apache.org
> Subject: Re: suggestion for dtd
>
>
> On Wed, Nov 06, 2002 at 07:19:42AM -0800, Robert Koberg wrote:
> ...> > http://xml.apache.org/forrest/your-project.html#N1014A
> > >
> > > as soon as someone regenerates the site, that URL is liable to break.
> >
> > Well, I did say for links on the same page. If so, then this
> problem would not
> > occur.
>
> 'cept people tend to cut-and-paste whatever's in the browser location
> bar.
>
> > > So it might be best to abandon generate-id() altogether, and
> > > auto-generate an @id from the section title.  An anchor like
> > > #advanced_customizations is also more descriptive than #N1014A
> >
> > I like this more and am going to change the way I do TOCs to this. I like
> > descriptive URLs :). You can still use my template example and
> substitute some
> > xsl (a named template) that replaces spaces with underscores and
> removes things
> > that ID does not like (like a dot/period - or is this business logic :)
>
> I tried it with translate(title, '!@#$%...', '_____') once.. Saxon kept
> complaining and I kept adding chars..  Saxon won in the end :)  Guess
> I'll have to read the RFC to do it properly.
>
>
> --Jeff
>
>
> > thanks,
> > -Rob
> >
> > >
> > >
> > > --Jeff
> > >
> >
> >
>



Mime
View raw message