Ciao, come da titolo della discussione.

La validazione XHTML 1.0 segnala 3 errori:


Errors found while checking this document as XHTML 1.0 Transitional!

Validation Output: 3 Errors

Line 252, Column 23: document type does not allow element "style" here
<style type="text/css">

The element named above was found in a context where it is not allowed. This could mean that you have incorrectly nested elements -- such as a "style" element in the "body" section instead of inside "head" -- or two elements that overlap (which is not allowed).

One common cause for this error is the use of XHTML syntax in HTML documents. Due to HTML's rules of implicitly closed elements, this error can create cascading effects. For instance, using XHTML's "self-closing" tags for "meta" and "link" in the "head" section of a HTML document may cause the parser to infer the end of the "head" section and the beginning of the "body" section (where "link" and "meta" are not allowed; hence the reported error).

Line 400, Column 23: document type does not allow element "style" here
<style type="text/css">

The element named above was found in a context where it is not allowed. This could mean that you have incorrectly nested elements -- such as a "style" element in the "body" section instead of inside "head" -- or two elements that overlap (which is not allowed).

One common cause for this error is the use of XHTML syntax in HTML documents. Due to HTML's rules of implicitly closed elements, this error can create cascading effects. For instance, using XHTML's "self-closing" tags for "meta" and "link" in the "head" section of a HTML document may cause the parser to infer the end of the "head" section and the beginning of the "body" section (where "link" and "meta" are not allowed; hence the reported error).

Line 414, Column 23: document type does not allow element "style" here
<style type="text/css">

The element named above was found in a context where it is not allowed. This could mean that you have incorrectly nested elements -- such as a "style" element in the "body" section instead of inside "head" -- or two elements that overlap (which is not allowed).

One common cause for this error is the use of XHTML syntax in HTML documents. Due to HTML's rules of implicitly closed elements, this error can create cascading effects. For instance, using XHTML's "self-closing" tags for "meta" and "link" in the "head" section of a HTML document may cause the parser to infer the end of the "head" section and the beginning of the "body" section (where "link" and "meta" are not allowed; hence the reported error).
Il problema sono dei fogli di stile che funzionano in base a delle query eseguite in ASP e che ho dovuto inserire in dei contesti che probabilmente la validazione non consente.

Questo è il codice originale della pagina ASP.

Per le riga 252 segnalata come errore:
codice:
<%

  SQL = "SELECT *, SUBSTRING_INDEX(SUBSTRING_INDEX(CSS2,'/',4),'/',-1) CARTELLA "
  SQL = SQL & " FROM TBL_E "
  SQL = SQL & " WHERE 1 "
  SQL = SQL & " AND DATA >= CURRENT_DATE "
  SQL = SQL & " AND VALIDO = 0 "
  SQL = SQL & " ORDER BY DATA ASC " 
               
  set objRs = Server.CreateObject("ADODB.Recordset")
  objRs.Open SQL, objConn
          
  If Not objRs.EOF Then

<style type="text/css">
<!--
.latestprojectspic {
	background-image: url(/casting/images/<%=objRs.fields("cartella")%>/<%=objRs.fields("css")%>);
	background-repeat: no-repeat;
	margin: 0px;
	float: left;
	height: 133px;
	width: 236px;
	padding-top: 25px;
	padding-right: 0px;
	padding-bottom: 0px;
	padding-left: 165px;
}
-->
</style>

     <div class="latestprojectspic"></div>
<%
     end if
     objRs.close()
     set objRs = Nothing     
%>
Per le righe 400 e 414 segnalate come errore:
codice:
<%
     SQL = " SELECT DISTINCT * FROM tbl_gallerypics " 
     SQL = SQL & " ORDER BY RAND() LIMIT 0, 2 "
          
     set objRs = Server.CreateObject("ADODB.Recordset")
     objRs.Open SQL, objConn
          
     If Not objRs.EOF Then
     Do While Not objRs.EOF
%>       

<style type="text/css">
<%=objRs.fields("stile")%>
</style>     
     <div class="<%=objRs.fields("pic")%>"></div>
<%
     objRs.MoveNext()
     Loop
     end if
     objRs.close()
     set objRs = Nothing     
%>
Questo è invece l'output in html (riga 252):
codice:
document type does not allow element "style" here 

252.<style type="text/css">
253.<!--
254.latestprojectspic {
255.background-image: url(/casting/images/cartella1/logo.jpg);
256.background-repeat: no-repeat;
257.margin: 0px;
258.float: left;
259.height: 133px;
260.width: 236px;
261.padding-top: 25px;
262.padding-right: 0px;
263.padding-bottom: 0px;
264.padding-left: 165px;
265.}
265.-->
266.</style>

Output in html (righe 400 e 414):
codice:
document type does not allow element "style" here

400.<style type="text/css">
401.gallerypic6 { 
402.background-image : url(/casting/images/_gallery/gallery6.jpg); 
403.background-repeat : no-repeat; 
404.margin : 3px; 
405.padding : 0; 
406.float : left; 
407.height : 90px; 
408.width : 120px; 
409.} 
410.</style> 


414.<style type="text/css">
415.gallerypic5 { 
416.background-image : url(/casting/images/_gallery/gallery5.jpg); 
417.background-repeat : no-repeat; 
418.margin : 3px; 
419.padding : 0; 
420.float : left; 
421.height : 90px; 
422.width : 120px; 
423.} 
424.</style>
Avete idea come si possa risolvere?
Grazie mille.