Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: [xsl] xsl:element will not create an output element, in any context

From: Abel Braaksma <abel.online@--------->
To:
Date: 6/1/2007 2:51:00 AM
N David Brown wrote:
Ok, back from work now, so have had time to test =D



@Abel -



I tried running your Hello World test, and it worked fine =)



I took note of your 'need an html, title... element in the output' 
comment, and tried using this -

title must not be empty.

and there are more things missing in your stylesheet to make it XHTML, 
see my comments in my earlier post. But that shouldn't stop browsers 
from rendering your output, which is close enough to XHTML.




<xsl:stylesheet version="1.0"

   xmlns:xsl="http://www.w3.org/1999/XSL/Transform"

   xmlns:xhtml="http://www.w3.org/1999/XHTML">

 

You are not using your xhtml namespace. Furthermore, the namespace is 
not the correct namespace. See my earlier post. You are creating HTML, 
ok, but not XHTML.




- but it didn't work. Still no elements were output; only the 
'value-of's.

I took the liberty to download libxslt from here: 
http://www.zlatkovic.com/pub/libxml/ to test what you tested. I run 
libxslt like so:



   xsltproc dbrowntest.xslt dbrowninput.xml



and it produced, using your stylesheet and your xml, the following HTML 
(not XML or XHTML!) output:



   <html xmlns:xhtml="http://www.w3.org/1999/XHTML">

       <head>

           <meta http-equiv="Content-Type" content="text/html; 
charset=UTF-8">

               <title></title>

       </head>

       <body><ul>

           <li>

               tier00

               <ul>

                   tier00

                   <li>

                       tier10

                       <ul>

                           tier10

                           <li>

                               tier20

                               <ul>

                                   tier20

                                   <li>file0</li>

                               </ul>

                           </li>

                       </ul>

                   </li>

               </ul>

           </li>

           <li>

               tier01

               <ul>

                   tier01

                   <li>

                       magic

                       <ul>

                           magic

                           <li>

                               random

                               <ul>

                                   random

                                   <li>anotherFile2</li>

                                   <li>anotherFile</li>

                               </ul>

                           </li>

                       </ul>

                   </li>

                   <li>

                       tier11

                       <ul>

                           tier11

                           <li>

                               tier21

                               <ul>

                                   tier21

                                   <li>file1</li>

                               </ul>

                           </li>

                       </ul>

                   </li>

               </ul>

           </li>

       </ul></body>

   </html>





I just tried this, and it output only the 'value-of's, nothing more... 
I tried setting output to 'html', 'xml' and not including the tag at 
all, but nothing produced the UL and LI elements. I'm transforming 
using my PHP now, as Abel, suggested, and the content is dumped to a 
text file so there's no worry I'm missing something that's actually 
there ;)

That was David's suggestion, not mine. I just re-emphasized ;)

I am wondering what you mean with "value-of's" or what you use to look 
at you core content. If you use PHP, and you use it from your browser, 
do you actually use View Source? I tried you example, and it rendered 
like a tree, the same that displays on David's site.




Additionally, I tried this latest example with 'xml version="2.0"' 
declared, but to no avail, regardless of 'html/xml' output attribute 
value. I also tried all of these tests with this elemented wrapped 
around the dir template's contents:



   <xsl:element name="test">
   ....
   </xsl:element>

As I said before, I'm viewing the direct, dumped output, so I'm not 
just failing to observe something that's actually there, I don't think...

This is no use. Once you do this, the output fails to be HTML. HTML 
still does not have an element <test> and will never have.




So guys, you see why I'm stumped! What should I try next?

Try the link of David. I tried it, too, and I see a visual tree. Or try 
what I tried with XSLT. Or, if your examples above do not match your 
real data, try your own examples instead of the real data and go from there.



In addition to checking the content-type of your output that David 
suggests, try running it locally like I did, rename the output xxx.html 
and serve the html page. If you now still see nothing, it really is some 
configuration error of your Apache or other server. If you suddenly see 
the correct output, it is also a configuration error: likely the 
content-type in the HTTP headers (but that shouldn't stop the View 
Source from showing the actual content).



Cheers,
-- Abel Braaksma


transparent
Print
Mail
Digg
delicious
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent