The Grey Labyrinth is a collection of puzzles, riddles, mind games, paradoxes and other intellectually challenging diversions. Related topics: puzzle games, logic puzzles, lateral thinking puzzles, philosophy, mind benders, brain teasers, word problems, conundrums, 3d puzzles, spatial reasoning, intelligence tests, mathematical diversions, paradoxes, physics problems, reasoning, math, science.

   
The Grey Labyrinth Forum Index
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups    RegisterRegister  
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

.xsl

 
Reply to topic    The Grey Labyrinth Forum Index -> Off-Topic
View previous topic :: View next topic  
Author Message
Courk
Daedalian Member



PostPosted: Sun Feb 10, 2013 4:28 pm    Post subject: 1 Reply with quote

I got a crash course in .xml the other day. I understood it fairly well, up until xsl came up. I planned to review the slides containing that information -- I figured I was just tired at the end of a long day and just couldn't properly process it at the time. However, the slides we were given didn't contain the xsl information. I'm going to ask for those, but since I remember not fully grasping it in the first place, I figured I'd ask for help in the mean time, since I'll likely be asking later, anyway.

I know you write the .xml code you need. I know the you need xsl for the computer to be able to read and display the xml properly, but that's where I get lost. xsl is another xml-type file, but it's saved as .xsl rather than .xml. But the .xml file needs to refer to it? How does the .xml file refer to it? What are the required components of the .xsl file?
Back to top
View user's profile Send private message Send e-mail AIM Address
Courk
Daedalian Member



PostPosted: Sun Feb 10, 2013 4:48 pm    Post subject: 2 Reply with quote

Got the missing slides. I think I might get it now. Later I'm going to upload something as if I'm teaching it to others, if you guys wouldn't mind checking my thinking and reasoning? Thanks! Felicitous
Back to top
View user's profile Send private message Send e-mail AIM Address
Zag
Unintentionally offensive old coot



PostPosted: Sun Feb 10, 2013 5:30 pm    Post subject: 3 Reply with quote

Courk wrote:
I know the you need xsl for the computer to be able to read and display the xml properly..

Not exactly true. I've been using XML since 1999, and I've never used XSL. However, I have never used XML as a language for presenting data directly to humans, only for moving data from computer to computer. (and then HTML, built with JSP, for presenting to humans. In reality, I was writing code that wrote the JSP. It's turtles all the way down.) I don't think many people really do use XSL to present XML data directly to humans. I'm not quite ready to go out on a limb and say nobody, but that's what I'm thinking. Its use seems almost completely confined to the academic world, not the real one.

That was certainly the intent of XSL. It's a language for transforming XML documents and presenting them to humans. It tries to serve the same purpose as CSS and (to a lesser extent) JavaScript does in HTML pages, but it has not really succeeded in either.

I just did a quick check on Monster to see if anyone is advertising jobs looking for people with XSL experience. While there are a few that mention it, I didn't see any in the real hotbeds of software development (i.e. Boston, San Francisco, Seattle, Raleigh-Durham, Austin) which tells me that nobody serious is using it. Also, the ones I saw just listed it among a bunch of skills that an applicant should have, but it didn't really seem like a hard requirement.

XML
XML is a generic way to represent any sort of data in a controlled (i.e. machine-readable) way. One can make specific language built on XML. For instance, if I'm writing code for warehouse inventory, I might make a "language" which describes the items I have stored in the warehouse, having data like ItemID, Location, Quantity, etc. The real storage for this information is a database somewhere, but when I want to make, say, an iPhone app that helps workers find out where to go to get specific items, that information has to travel through the communications layer in some form. By basing my language on XML, I can use off-the-shelf tools for assembling the text I will transfer from the server, and then using the data in my iPhone app.

XSD
When I make one of these new languages based on XML, I want to be able to describe the new language precisely. I want to be able to look at a message containing some of this data and be able to say whether or not it is well-formed. Imagine if the server software that is serving up the inventory data did not quite agree with the iPhone software that wants to use this data -- you'd constantly have problems where the iPhone software thinks that data is missing or wrong. XSD describes precisely the new language (i.e. my warehouse info language). It says, for instance, the precise names of fields, which are required and which are optional, valid values for them, etc. Of course, the languages that it describes are all based on XML, but they are each a more specific version of XML, with a specific shape.

And for the trick: When they made XSD, they realized that this is just a language for describing data languages. We already know how to make new languages which are based on XML. We might as well make our new language based on XML, too. The fact that XSD is one of the many XML-based languages is irrelevant to its purpose, in the same way that the fact that my warehouse info language is based on XML. That was just a convenient starting point.

By the way, the first pass at making a language to describe XML-based languages was DTD. It is not an XML-based language, but an entirely new language they designed from scratch. This demonstrates that the people who designed DTD were morons.

XSL
XSL is yet another language with a specific purpose: to define, for a specific XML language, how to display it for humans to read the data. It also defines transforms on the data, which seems sort of slapped on the side when they realized that sometimes you need to transform data before you display it. The idea that you have this machine-readable data language, but with only a good presentation definition, you can show the data to humans in a good way is quite appealing. By and large, I don't think it was successful, because software UI designers want to be able to specify more precisely how stuff should look on the screen. Every new feature added to XSL to specify things more and more precisely (with all the special cases that the UI Designers wanted) just made the language too cumbersome.

Anyway, much like with XSD, they realized that they are just creating a new language to contain a type of data. They might as well make the language based on XML, since it is a good starting point for making machine-readable languages for containing data.

So the fact that XSL and XSD are both XML-based languages has nothing to do with their function. It was just a convenience because, if you're using them, you've already got all the tools for working with XML-based languages.
Back to top
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger
Nsof
Daedalian Member



PostPosted: Mon Feb 11, 2013 7:52 am    Post subject: 4 Reply with quote

I have worked with xslt in the past. Wikipedia has a good diagram that explains what it is.

Note that the resultant document does NOT have to be in xml format - it can be any text format you want.

In the company I worked for we used it to extract data scraped from websites/pages. Scraped in this context means: taken out of the html.
Imagine you have lots of html pages of a forum (imagine GL) stored as files on a server. One file for each of the pages in the forum. e,g, this thread would be a single file with a few posts in it (at least up until now) whereas "what made you happy" thread will be stored as a few hundred files each with 40 posts in it (except for the file representing the last thread's page which will have less than that).
What we wanted was all the text of the posts without the rest of the data.

The process was as follows:
1) We converted all the HTML to XML files so we could work on them. (HTML is not well formed XML and is not easily read by machines - even browsers sometimes have trouble).

2) We created one XSLT file (with .xsl extension) that instructs the XSLT processor, given an input file as above, to output a text file with one post's text per line.

3) We looped through all the files and one by one got all the posts of the forum
_________________
Will sell this place for beer
Back to top
View user's profile Send private message
Display posts from previous: by   
Reply to topic    The Grey Labyrinth Forum Index -> Off-Topic All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Site Design by Wx3