[Hippo-cms7-user] Head contribution in tag file results in invalid html

Cuno cuno.de.boer at gmail.com
Fri Sep 10 15:55:15 CEST 2010


Hi,

I want to create a tag file to make adding head contributions a little
shorter.

This code is in my jsp:

<hst:link var="screencss" path="/css/indivirtual/nl/screen.css" />
<hst:element var="screen" name="link">
	<hst:attribute name="type" value="text/css" />
	<hst:attribute name="href" value="${screencss}" />
	<hst:attribute name="rel" value="stylesheet" />
	<hst:attribute name="media" value="screen" />
</hst:element>
<hst:headContribution element="${screen}" />

That works fine, it gives me: <link rel="stylesheet" type="text/css"
media="screen" href="/site/css/indivirtual/nl/screen.css"/>


But when I put the exact same code inside a tag file (linkheadcontrib.tag):

<%@ tag description="A shorter way to define header contributions." %>
<%@ tag body-content="empty" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://www.hippoecm.org/jsp/hst/core" prefix='hst' %>
<%@ attribute name="path" required="true" %>

<hst:link var="screencss" path="/css/indivirtual/nl/screen.css" />
<hst:element var="screen" name="link">
	<hst:attribute name="type" value="text/css" />
	<hst:attribute name="href" value="${screencss}" />
	<hst:attribute name="rel" value="stylesheet" />
	<hst:attribute name="media" value="screen" />
</hst:element>
<hst:headContribution element="${screen}" />

Then I get a different result:

<link rel="stylesheet" type="text/css" media="screen"
href="/site/css/indivirtual/nl/screen.css">
			
			
			
			
</link>

which isn't valid xhtml according to the w3.org validator.


Does anyone know why this is happening and/or how to fix this in the tag
file?

Regards,
Cuno
-- 
View this message in context: http://hippo.2275632.n2.nabble.com/Head-contribution-in-tag-file-results-in-invalid-html-tp5518384p5518384.html
Sent from the Website Development mailing list archive at Nabble.com.



More information about the Hippo-cms7-user mailing list