You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@forrest.apache.org by Oshani Seneviratne <os...@apache.org> on 2007/07/05 20:44:13 UTC

How do you add a link tag?

Hi,

In the FOAF plugin, I was trying to make the FOAF data get
auto-discovered by a tool like Semantic Radar [1]. To do that, I
believe there should be a link tag, such as the following, inside the
head element of the page.

<link rel="meta" type="application/rdf+xml" href="foaf.rdf" />

I could not find any DTD in document-v20 [2] for 'link', so I was
unable to add it in the xsl which transforms the FOAF into XDoc.

However, I see that some link tags are included (css files for
example) in the final HTML page generated. But I couldn't figure out
where those are picked up in the pipeline.

So I would really appreciate any advice on what I should do to get a
link tag included in a page.

Thanks,
Oshani

[1] https://addons.mozilla.org/en-US/firefox/addon/3886
[2] http://forrest.apache.org/dtdx/document-v20.dtdx.html

Re: How do you add a link tag?

Posted by Oshani Seneviratne <os...@gmail.com>.
On 7/13/07, David Crossley <cr...@apache.org> wrote:
> David Crossley wrote:
> > Ross Gardler wrote:
> > > Oshani Seneviratne wrote:
> > > >
> > > >In the FOAF plugin, I was trying to make the FOAF data get
> > > >auto-discovered by a tool like Semantic Radar [1]. To do that, I
> > > >believe there should be a link tag, such as the following, inside the
> > > >head element of the page.
> > > >
> > > ><link rel="meta" type="application/rdf+xml" href="foaf.rdf" />
> > > >
> > > >I could not find any DTD in document-v20 [2] for 'link', so I was
> > > >unable to add it in the xsl which transforms the FOAF into XDoc.
> > > >
> > > >However, I see that some link tags are included (css files for
> > > >example) in the final HTML page generated. But I couldn't figure out
> > > >where those are picked up in the pipeline.
> > > >
> > > >So I would really appreciate any advice on what I should do to get a
> > > >link tag included in a page.
> > >
> > > These are added by the skinning system. Using skins there is no easy
> > > way to do this since there is no (easy) way for the skin to know when
> > > it should be adding the link. I'm afraid it is one of the drawbacks of
> > > the skinning system. It is possible, but it is hacky and I don't
> > > recommend going down that route as it will mean having to maintain a
> > > new skin, which we don't want to do.
> > >
> > > We could consider adding handling of the link element in XDoc (it is
> > > XHTML2 compat, so is likely to be accepted by the community).
> >
> > Yes this would be fine. As said in our mail archives,
> > anything that is in our xhtml subset [1] can be added
> > to xdoc. We are only doing it element-by-element as they
> > are needed.
> > [1] $FORREST_HOME/main/main/webapp/resources/schema/relaxng/WD-xhtml2-20050527
> >
> > However i wonder if there is an issue:
> > Adding it to document-v2 would be okay. As our
> > internal format is document-v13, then it would also
> > need to be enabled there. However we already have
> > a "link" element with a different purpose.
> >
> > I can see a workaround. We don't xml validate
> > the internal format, so we can inject any element
> > that we need.
> >
> > I will add it to the v2 DTD.
> >
> > Meanwhile, to test you can add header/link elements
> > to a document-v20 doc and exclude the relevant docs from
> > validation by using forrest.properties config.
> >
> > Here is a patch for the skins stylesheets common and pelt:
>
> Okay. I added that today at r555841.
>
> The DTD changes still need to be done, so use the
> validation exclusion described above.
>

Thanks!

Re: How do you add a link tag?

Posted by David Crossley <cr...@apache.org>.
David Crossley wrote:
> Ross Gardler wrote:
> > Oshani Seneviratne wrote:
> > >
> > >In the FOAF plugin, I was trying to make the FOAF data get
> > >auto-discovered by a tool like Semantic Radar [1]. To do that, I
> > >believe there should be a link tag, such as the following, inside the
> > >head element of the page.
> > >
> > ><link rel="meta" type="application/rdf+xml" href="foaf.rdf" />
> > >
> > >I could not find any DTD in document-v20 [2] for 'link', so I was
> > >unable to add it in the xsl which transforms the FOAF into XDoc.
> > >
> > >However, I see that some link tags are included (css files for
> > >example) in the final HTML page generated. But I couldn't figure out
> > >where those are picked up in the pipeline.
> > >
> > >So I would really appreciate any advice on what I should do to get a
> > >link tag included in a page.
> > 
> > These are added by the skinning system. Using skins there is no easy
> > way to do this since there is no (easy) way for the skin to know when
> > it should be adding the link. I'm afraid it is one of the drawbacks of
> > the skinning system. It is possible, but it is hacky and I don't
> > recommend going down that route as it will mean having to maintain a
> > new skin, which we don't want to do.
> > 
> > We could consider adding handling of the link element in XDoc (it is
> > XHTML2 compat, so is likely to be accepted by the community).
> 
> Yes this would be fine. As said in our mail archives,
> anything that is in our xhtml subset [1] can be added
> to xdoc. We are only doing it element-by-element as they
> are needed.
> [1] $FORREST_HOME/main/main/webapp/resources/schema/relaxng/WD-xhtml2-20050527
> 
> However i wonder if there is an issue:
> Adding it to document-v2 would be okay. As our
> internal format is document-v13, then it would also
> need to be enabled there. However we already have
> a "link" element with a different purpose.
> 
> I can see a workaround. We don't xml validate
> the internal format, so we can inject any element
> that we need.
> 
> I will add it to the v2 DTD.
> 
> Meanwhile, to test you can add header/link elements
> to a document-v20 doc and exclude the relevant docs from
> validation by using forrest.properties config.
> 
> Here is a patch for the skins stylesheets common and pelt:

Okay. I added that today at r555841.

The DTD changes still need to be done, so use the
validation exclusion described above.

-David

Re: How do you add a link tag?

Posted by David Crossley <cr...@apache.org>.
Ross Gardler wrote:
> Oshani Seneviratne wrote:
> >
> >In the FOAF plugin, I was trying to make the FOAF data get
> >auto-discovered by a tool like Semantic Radar [1]. To do that, I
> >believe there should be a link tag, such as the following, inside the
> >head element of the page.
> >
> ><link rel="meta" type="application/rdf+xml" href="foaf.rdf" />
> >
> >I could not find any DTD in document-v20 [2] for 'link', so I was
> >unable to add it in the xsl which transforms the FOAF into XDoc.
> >
> >However, I see that some link tags are included (css files for
> >example) in the final HTML page generated. But I couldn't figure out
> >where those are picked up in the pipeline.
> >
> >So I would really appreciate any advice on what I should do to get a
> >link tag included in a page.
> 
> These are added by the skinning system. Using skins there is no easy
> way to do this since there is no (easy) way for the skin to know when
> it should be adding the link. I'm afraid it is one of the drawbacks of
> the skinning system. It is possible, but it is hacky and I don't
> recommend going down that route as it will mean having to maintain a
> new skin, which we don't want to do.
> 
> We could consider adding handling of the link element in XDoc (it is
> XHTML2 compat, so is likely to be accepted by the community).

Yes this would be fine. As said in our mail archives,
anything that is in our xhtml subset [1] can be added
to xdoc. We are only doing it element-by-element as they
are needed.
[1] $FORREST_HOME/main/main/webapp/resources/schema/relaxng/WD-xhtml2-20050527

However i wonder if there is an issue:
Adding it to document-v2 would be okay. As our
internal format is document-v13, then it would also
need to be enabled there. However we already have
a "link" element with a different purpose.

I can see a workaround. We don't xml validate
the internal format, so we can inject any element
that we need.

I will add it to the v2 DTD.

Meanwhile, to test you can add header/link elements
to a document-v20 doc and exclude the relevant docs from
validation by using forrest.properties config.

Here is a patch for the skins stylesheets common and pelt:

----------
Index: common/xslt/html/site-to-xhtml.xsl
===================================================================
--- common/xslt/html/site-to-xhtml.xsl  (revision 553769)
+++ common/xslt/html/site-to-xhtml.xsl  (working copy)
@@ -330,6 +330,13 @@
         </xsl:if>
       </xsl:element>
     </xsl:for-each>
+    <xsl:for-each select="//meta-data/a">
+<!-- FIXME: the document/header/link elements were earlier transformed to "a"
+along with all other "link" elements. -->
+      <xsl:element name="link">
+        <xsl:apply-templates select="@*"/>
+      </xsl:element>
+    </xsl:for-each>
   </xsl:template>
   <xsl:template name="feedback">
     <div id="feedback">
Index: pelt/xslt/html/document-to-html.xsl
===================================================================
--- pelt/xslt/html/document-to-html.xsl (revision 553072)
+++ pelt/xslt/html/document-to-html.xsl (working copy)
@@ -24,6 +24,7 @@
   <xsl:template match="document">
     <meta-data>
       <xsl:apply-templates select="header/meta"/>
+      <xsl:apply-templates select="header/link"/>
     </meta-data>
     <div id="content">
       <div id="skinconf-printlink"/>
----------

Does anyone see any problem with doing this?

-David

Re: How do you add a link tag?

Posted by Ross Gardler <rg...@apache.org>.
On 07/07/07, Oshani Seneviratne <os...@apache.org> wrote:
> On 7/6/07, Ross Gardler <rg...@apache.org> wrote:
> > On 05/07/07, Oshani Seneviratne <os...@apache.org> wrote:
> > > Hi,
> > >
> > > In the FOAF plugin, I was trying to make the FOAF data get
> > > auto-discovered by a tool like Semantic Radar [1]. To do that, I
> > > believe there should be a link tag, such as the following, inside the
> > > head element of the page.
> > >
> > > <link rel="meta" type="application/rdf+xml" href="foaf.rdf" />
> > >
> > > I could not find any DTD in document-v20 [2] for 'link', so I was
> > > unable to add it in the xsl which transforms the FOAF into XDoc.
> > >
> > > However, I see that some link tags are included (css files for
> > > example) in the final HTML page generated. But I couldn't figure out
> > > where those are picked up in the pipeline.
> > >
> > > So I would really appreciate any advice on what I should do to get a
> > > link tag included in a page.
> >
> > These are added by the skinning system. Using skins there is no easy
> > way to do this since there is no (easy) way for the skin to know when
> > it should be adding the link. I'm afraid it is one of the drawbacks of
> > the skinning system. It is possible, but it is hacky and I don't
> > recommend going down that route as it will mean having to maintain a
> > new skin, which we don't want to do.
> >
> > We could consider adding handling of the link element in XDoc (it is
> > XHTML2 compat, so is likely to be accepted by the community).
> >
> > It is much easier if using the dispatcher (see the DOAP plugin for an
> > example of exactly what you want to do - but only if you want to work
> > with the dispatcher).
> >
> > So, do you fancy going with the dispatcher or do you fancy getting
> > into the internals of Forrest? (or ignore it completely for now, add
> > an issue to the issue tracker and move on to another requirement).
> >
>
>
> I had a look at the doap plugin to see how you have done it using the
> dispatcher.

Since David has picked up the XDoc route, I'll help you on the
dispatcher side. Pick whichever direction you want to take.

> But there are few things that I was not able to understand
> there. For instance, in [1] there is the following piece of code:
>
> [1]$FORREST_HOME/whiteboard/plugins/o.a.f.p.i.doap/resources/themes/common/html/doap-embedded.ft
>
> <forrest:template xmlns:forrest="http://apache.org/forrest/templates/1.0"
>     name="doap-embedded" inputFormat="xsl">
> .
> .
> .
>    <xsl:template match="doap[@url]"><link rel="meta" type="application/rdf+xml">
> .
> .
>
> Does this doap[@url] refer to the<doap> element in the
> src/resources/themes/pelt.fv ?

No, it is a parameter passed in to the element, see the usage
instructions earlier in the quoted file.

> But it throws up this error saying "dispatcherError:Could not
> get the properties for cocoon://index.props". (Please find the full
> trace at the end of the mail)
> What do you think I am doing wrong here?

Be sure that you have enabled the plugins needed for the dispatcher,
unfortunately there is no automated dependency resolution in our
plugin system and so you have to manage these dependencies manually.
In short you must have all of the following in the property
project.required.plugins in your forrest.properties file:

org.apache.forrest.plugin.internal.dispatcher,org.apache.forrest.themes.core,org.apache.forrest.plugin.output.inputModule

The inputModule one is the one that usually relates to the above error.

> So, I guess I will leave out adding the <link> tag for a while.This
> was not a major requirement, and I have some code that I would like to
> get committed first, so this could wait a bit. (I got a bit carried
> away to do something like the FOAF-Explorer [2] and try out the
> Semantic Radar when there are multiple FOAF files.)

Yes, release early, release often. If you have some code in there that
does not quite work tthen add an issue to the tracker so that we don't
forget it.

SImilarly, if you have ideas about the direction the plugin should go
in, but have not done it yet (i.e. the FOAF explorer) then add an
issue as a reminder and an aid to our collective memory about how to
go about moving forwards.

Ross

Re: How do you add a link tag?

Posted by Oshani Seneviratne <os...@apache.org>.
On 7/6/07, Ross Gardler <rg...@apache.org> wrote:
> On 05/07/07, Oshani Seneviratne <os...@apache.org> wrote:
> > Hi,
> >
> > In the FOAF plugin, I was trying to make the FOAF data get
> > auto-discovered by a tool like Semantic Radar [1]. To do that, I
> > believe there should be a link tag, such as the following, inside the
> > head element of the page.
> >
> > <link rel="meta" type="application/rdf+xml" href="foaf.rdf" />
> >
> > I could not find any DTD in document-v20 [2] for 'link', so I was
> > unable to add it in the xsl which transforms the FOAF into XDoc.
> >
> > However, I see that some link tags are included (css files for
> > example) in the final HTML page generated. But I couldn't figure out
> > where those are picked up in the pipeline.
> >
> > So I would really appreciate any advice on what I should do to get a
> > link tag included in a page.
>
> These are added by the skinning system. Using skins there is no easy
> way to do this since there is no (easy) way for the skin to know when
> it should be adding the link. I'm afraid it is one of the drawbacks of
> the skinning system. It is possible, but it is hacky and I don't
> recommend going down that route as it will mean having to maintain a
> new skin, which we don't want to do.
>
> We could consider adding handling of the link element in XDoc (it is
> XHTML2 compat, so is likely to be accepted by the community).
>
> It is much easier if using the dispatcher (see the DOAP plugin for an
> example of exactly what you want to do - but only if you want to work
> with the dispatcher).
>
> So, do you fancy going with the dispatcher or do you fancy getting
> into the internals of Forrest? (or ignore it completely for now, add
> an issue to the issue tracker and move on to another requirement).
>


I had a look at the doap plugin to see how you have done it using the
dispatcher. But there are few things that I was not able to understand
there. For instance, in [1] there is the following piece of code:

[1]$FORREST_HOME/whiteboard/plugins/o.a.f.p.i.doap/resources/themes/common/html/doap-embedded.ft

<forrest:template xmlns:forrest="http://apache.org/forrest/templates/1.0"
    name="doap-embedded" inputFormat="xsl">
.
.
.
   <xsl:template match="doap[@url]"><link rel="meta" type="application/rdf+xml">
.
.

Does this doap[@url] refer to the<doap> element in the
src/resources/themes/pelt.fv ?
Assuming that it is,  I hacked up a similar contract for the FOAF
plugin. But it throws up this error saying "dispatcherError:Could not
get the properties for cocoon://index.props". (Please find the full
trace at the end of the mail)
What do you think I am doing wrong here?

So, I guess I will leave out adding the <link> tag for a while.This
was not a major requirement, and I have some code that I would like to
get committed first, so this could wait a bit. (I got a bit carried
away to do something like the FOAF-Explorer [2] and try out the
Semantic Radar when there are multiple FOAF files.)

[2] http://xml.mfd-consult.dk/foaf/explorer/

Thanks,
Oshani

------------------------------------------------------------------
dispatcherError:
Could not get the properties for cocoon://index.props
 DispatcherStack: org.apache.excalibur.source.SourceNotFoundException:
Exception during processing of cocoon://index.props
	at <map:serialize type="xhtml"> -
file:/E:/projects/forrest/build/plugins/org.apache.forrest.plugin.internal.dispatcher/internal.xmap:177:39
	at <map:transform> -
file:/E:/projects/forrest/build/plugins/org.apache.forrest.plugin.internal.dispatcher/internal.xmap:176:13
	at <map:transform> -
file:/E:/projects/forrest/build/plugins/org.apache.forrest.plugin.internal.dispatcher/internal.xmap:173:13
	at <map:transform type="dispatcher"> -
file:/E:/projects/forrest/build/plugins/org.apache.forrest.plugin.internal.dispatcher/internal.xmap:163:42
	at <map:generate type="jx"> -
file:/E:/projects/forrest/build/plugins/org.apache.forrest.plugin.internal.dispatcher/internal.xmap:157:70
	at <map:mount> -
file:/E:/projects/forrest/whiteboard/plugins/org.apache.forrest.plugin.input.foaf/build/tmp/internal.xmap:33:158
	at <map:mount> - file:/E:/projects/forrest/main/webapp/sitemap.xmap:355:118

Re: How do you add a link tag?

Posted by Ross Gardler <rg...@apache.org>.
On 05/07/07, Oshani Seneviratne <os...@apache.org> wrote:
> Hi,
>
> In the FOAF plugin, I was trying to make the FOAF data get
> auto-discovered by a tool like Semantic Radar [1]. To do that, I
> believe there should be a link tag, such as the following, inside the
> head element of the page.
>
> <link rel="meta" type="application/rdf+xml" href="foaf.rdf" />
>
> I could not find any DTD in document-v20 [2] for 'link', so I was
> unable to add it in the xsl which transforms the FOAF into XDoc.
>
> However, I see that some link tags are included (css files for
> example) in the final HTML page generated. But I couldn't figure out
> where those are picked up in the pipeline.
>
> So I would really appreciate any advice on what I should do to get a
> link tag included in a page.

These are added by the skinning system. Using skins there is no easy
way to do this since there is no (easy) way for the skin to know when
it should be adding the link. I'm afraid it is one of the drawbacks of
the skinning system. It is possible, but it is hacky and I don't
recommend going down that route as it will mean having to maintain a
new skin, which we don't want to do.

We could consider adding handling of the link element in XDoc (it is
XHTML2 compat, so is likely to be accepted by the community).

It is much easier if using the dispatcher (see the DOAP plugin for an
example of exactly what you want to do - but only if you want to work
with the dispatcher).

So, do you fancy going with the dispatcher or do you fancy getting
into the internals of Forrest? (or ignore it completely for now, add
an issue to the issue tracker and move on to another requirement).

Ross