forrest-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeff Turner <je...@apache.org>
Subject Re: problem adding tld document type
Date Tue, 29 Apr 2003 10:33:52 GMT
On Tue, Apr 29, 2003 at 11:49:09AM +0200, Flavio Tordini wrote:
> hi all,
> forrest is a wonderful tool, but i'm having a problem generating
> documentation for a tld file. i added this to sitemap.xmap:
> 
> <!-- TLD support (FT) -->
>         <map:match pattern="body-taglib.xml">
>           <map:generate src="content/xdocs/taglib.xml"/>
>           <map:transform src="resources/stylesheets/tld2document.xsl"/>
>           <map:call resource="skinit">
>             <map:parameter name="type" value="document2html"/>
>             <map:parameter name="path" value="taglib.xml"/>
>           </map:call>
>         </map:match>
> 
> i created the a basic xsl and added an item in site.xml.
> but the xsl seem not to work.
> 
> <?xml version="1.0"?>
> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> version="1.0">
>   <xsl:output method="xml" indent="no" doctype-system="document-v11.dtd"
> doctype-public="-//APACHE//DTD Documentation V1.1//EN" encoding="UTF-8"/>
>   <xsl:template match="/">
>     <document>
>       <header>
>         <title>TITLE: <xsl:value-of select="taglib/short-name"/></title>
>       </header>
>       <body>BODY: <xsl:value-of select="taglib/description"/>, TAGNAME:
> <xsl:value-of select="name(child::*)"/></body>
>     </document>
>   </xsl:template>
> </xsl:stylesheet>
> 
> on the generated HTML i see:
> TITLE:
> BODY: , TAGNAME: taglib
> 
> curiosly the xpath name() function works while all other value-of tags
> return a blank string.
> 
> ANY SUGGESTIONS??? am i missing something?

Playing around with a tld from Struts, I found that the DTD quietly
defines a default namespace for all elements:

<!ATTLIST taglib id ID #IMPLIED
      xmlns CDATA #FIXED
        "http://java.sun.com/j2ee/dtds/web-jsptaglibrary_1_1.dtd"

This is in http://java.sun.com/j2ee/dtds/web-jsptaglibrary_1_1.dtd, referenced
in the <!DOCTYPE> declaration.

So expressions like <xsl:value-of select="taglib/description"/> won't work;
you'll need to define a prefix->namespace mapping, and use a prefix on each
path segment.  Attached is a modified version of your stylesheet that works for
me.

Btw, its always a good idea to check stylesheets "by hand" before running them
through Forrest, which tends to obfuscate errors.

--Jeff

> flavio
> 
> 

Mime
View raw message