aspose file tools*
The moose likes XML and Related Technologies and the fly likes xsl tag problem? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "xsl tag problem?" Watch "xsl tag problem?" New topic
Author

xsl tag problem?

Sam Doder
Ranch Hand

Joined: Feb 06, 2008
Posts: 204
I am wondering why I get errors if I put a html break
tag in my xsl file

here is the xsl file


Works fine when I put starting and closing br tags but gives me an error if I just use

tags ,...etc with no closing tag.
My question is if I am going to embed html,xhtml ...etc in my xsl file must I always close the tags even if in valid html it isn't really required a

to break to the next line just


Also I am wondering why the attributes that do my styleing are not displaying at all just the standard texted???

Thanks

Matthew Brown
Bartender

Joined: Apr 06, 2010
Posts: 4460
    
    8

Your XSL file has got to be valid XML. That means either closing tags or proper empty tags - e.g. <br/>. (Which you have to do anyway if you want it to be valid XHTML).

If you've got the output method set correctly (using <xsl:output>) it will sort out the output for you. E.g. using <xsl:output="html" /> will make sure <br/> tags in the document are output as <br>.
Sam Doder
Ranch Hand

Joined: Feb 06, 2008
Posts: 204
ok , got you so you must either use xhtml or close every start tag with an end tag.

But do you mean you can use just the regular old html br syntax if you do
<xslutput="html" method="html" encoding="UTF-8" />

because I tried that and it still gave me errors also the style of the font,...etc attribute are not working ???

Here is my xml file if you have a chance and could explain why the style attributes aren't working as well that would be great.



my xsl is named t2.xsl change according to your xsl file name...etc
Matthew Brown
Bartender

Joined: Apr 06, 2010
Posts: 4460
    
    8

Sam Doder wrote:But do you mean you can use just the regular old html br syntax if you do
<xsl:output="html" method="html" encoding="UTF-8" />

No. Your XSL is still an XML document, so it has to be valid XML - you've got to use <br/>. But you can have <br> in the output if you want, by setting the output method.

Sorry, I haven't used XSL-FO, so I don't know what the problem with the styling is. What's the exact output that's being produced? That might help.
Sam Doder
Ranch Hand

Joined: Feb 06, 2008
Posts: 204
I thought xsl was not xml it is an extension of css to take an xml and display it in a human readable format like xhtml in a web browser... etc

Sorry, I haven't used XSL-FO, so I don't know what the problem with the styling is. What's the exact output that's being produced? That might help.




if you test out it on your computer you should see a plane format ....

Curious does anybody know if you can use external xsl files instead of external css files in an xhtml or html file?
Or is xsl only used for xml based files and transforming xml files..etc?
Matthew Brown
Bartender

Joined: Apr 06, 2010
Posts: 4460
    
    8

Sam Doder wrote:
I thought xsl was not xml it is an extension of css to take an xml and display it in a human readable format like xhtml in a web browser... etc

It's a language for transforming and formatting XML, but it's also an XML format in its own right. Check out the first line of your stylesheet.
Sam Doder
Ranch Hand

Joined: Feb 06, 2008
Posts: 204
O, never looked at it like that....

So in theory you could use an xsl file to display an xsl file provided you rename the .xsl file that you included the other xsl file as a .xml....

duno why you would ever do such a thing but it should be possible.

Both are xml based files but usually 99% of the time xsl is only for displaying an xml page and really isn't considered an xml data storage file.

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: xsl tag problem?