Jump to content

xhtml to xsl conversion


rokroka

Recommended Posts

Ok im not new to development of xhtml/css but my development crew has changed the templating structure of our script to xsl/xlst. To me xsl is like reading Chinese math. However I understand how to follow the example in the w3schools section on xsl, but I could find no refrence or conversion tool to assist with the conversion of XHTML to xslt. Man im confused I really need to see a reference sheet or comparison or even one example of converting xhtml to xsl. ie: what does a div tag considered in xsl I see some reference to tables but don’t much understand that either. A little help would be much appreciated in explaining this conversion to me in simple terms if there is any way to do so.

Link to comment
Share on other sites

A <div> is still a <div> in XSLT. XSLT is not a replacement of (X)HTML.Think of it as "platform independant server or client side scripting language".XSLT is used for converting an XML file to another XML based format (one of which is XHTML). At least that's the essential definition. However, if you turn the logic upside down, the things get interesting.Think of the XML file as the "per page" data or in other words: data that is unique to the page being displayed. By using XSLT, you can copy and/or transform this data AND add something (common) to it. That is one of the more simple things XSLT could be used for (as simply as server side includes) and it can do a lot more (if you expand the word "transform" further).You really don't need an (X)HTML to XML/XSLT covertion tool. Ask your crew about the format (a.k.a. "The data model") they plan to use for each page and try to follow it. For example, if they tell you that each individual page must have an <author> element, don't argue. Add it... it will be up to the person responsible for the XSLT to make use of the value inside.If you're responsible for the site's design, rather then it's content, say making CSS stylesheets and/or images, ask for a copy of "more frequently generated result trees". If the XSLT man is experienced enough, he ought to know what you mean.And what do you mean? Much like server side scripting languages, the user doesn't see the XSLT code itself when (s)he clicks "View Source". (S)He only sees the resulted XHTML of the process (or the XML input file in one special occasion). And much like the way PHP developers and CSS designers communitcate, you need to know the (X)HTML the CSS will be applyed to, not the PHP or in this case XSLT file.

Link to comment
Share on other sites

gee... thanks so basically html/xhtml is the same as always your saying and adding the xslt elements are like adding php in a sense... that was a great understanding you gave me, i wish the xslt school lesson was a lil better for me to understand from a design P.O.V. however i am studying and attempting to learn the new format. i will follow the insructions you gave and request the lists from my developer and see what i can come up with, really i hear some say its sooo simple however i have yet to see its simplicity, but one thing i am not is a quitter. i havent been at this long but i have been at this hard so thanks, im sure ill be back... also might you be able to send me a page all html with the xslt elemnt running in an integral format?i kind of learn backwards and it would be a great helpagain boen_robot! thanks

Link to comment
Share on other sites

It's simple once you understand the logic behind it... but hey, isn't every language like that?Perhaps comparing it to a S3L (Server Side Scripting Language) wasn't the wisest thing of me. There are two major differences in the process.First and most important is that XSLT is not embed in (X)HTML files (or XML files for that matter) the way S3Ls are. Perhaps that is the reason why it is hard for newbies to learn it. Instead, by using a third application called "XSLT processor" you call the XML file and the XSLT file and from it you generate the result tree (most often that is XHTML tree).Here comes the other big difference. The third application is not "fixed" which is why we say "platform independant". This processor can be on the server, or the client.If it's on the client, then the browser only needs the XML file. The XML file itself however must have a reference to the XSLT file. The browser looks at this reference and takes the XSLT file. It then performs the transformation and shows the user the result. The source XML is what will be shown to the user (remember the special case from before?).Another way on the client is by using JS. A JavaScript can take XML and XSLT file and produce a result tree. The browser then renders the page with the result tree in mind. The source code will be the (X)HTML page having the JS.If on the server, then the S3Ls' XSLT processor is used to perform the transformation. The result (source code the browser will see) can be a complete page, or if the S3L was embed in (X)HTML - the other (X)HTML + the result of the transformation in the place of the S3L code.Having that said, I can't give you examples "all html with the xslt elemnt running in an integral format" if that is what you had in mind. For examples, read the W3Schools tutorial. But read the XML and XPath tutorial before that. Without them, there's no way you can comprehend XSLT.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...