What does xslt do




















Just like there are standards with website code, there are also standards for the way XML is formatted. There are specially defined characters, markup rules, tags, elements, attributes, etc. You can learn more about XML here. Essentially, XML formats data so there can be no question about the information it represents.

Because XML is designed to separate data from the presentation of the information, it needs a bit of processing to become more transparent.

Take a look at some XML code for a document below:. XSLT is a programming language used to transform that code into beautiful PDF documents, web pages, plain text, or even printer friendly PostScrip format.

And the great thing is that the information can be arranged in virtually any desired layout. We put our layout in our asp page and insert some code behind for the dynamic parts. Another alternative is to foregoe the layout part and generate everything from say a database and using C creating our desired output. The problem with the first approach is that it's clumsy to go from descriptive data to actual content.

If you have some data file containing phone numbers which you want to present with headers for each letter, show a total nr of entries etc you'd have to have some of the layout in the layout file and some in the code you're generating.

Another option is to use some form of web-grid put I find those to be pretty messy and suddenly you have to learn how the frigging grid works when all you wanted to do was to output some specific html given the data.

Going totally dynamic is certainly an option but that's rather clumsy as well. Even in the best case where you're using something like LINQ you'll have to intermingle programming code with output in a rather ugly way. Also there's no good way to properly handle unstructured recursive document-style content which html usually is. With XSLT you simply can make a template for a certain tag, either just as is or in the context of it's parent so it's rendered differently if it for instance is parentet by something else.

A rather long rambling answer but yes, I think there's great value in a descriptive template language and XSLT is the best and most standardized one we got so far. XSLT's biggest failing is it inability in any real implementation to minimize the amount of the document that needs to be kept in memory at a time for efficient processing.

Instead the whole document is read into some form of DOM representation and processing is done against that. If the document is very large, then so are the memory requirements. Yet many stylesheets clearly only need the current tag and a few others, e.

Yes, in terms of a language it's weird, but that's just a barrier to entry. If you know XSLT, it's often easier than the alternatives -- but if you will have large documents or lots of documents being processed at once the memory impact of XSLT often forces other, more time consuming alternatives. As a matter of fact, I think it is more efficient to use XSL than another language for presenting data. NET for example, you will see that is very difficult to present exactly what you want.

That's why this language will still be used in the future but i really hope that will be more stable and less complex. Sign up to join this community. The best answers are voted up and rise to the top. Stack Overflow for Teams — Collaborate and share knowledge with a private group. Create a free Team What is Teams? Learn more. Are there any good reasons to use, learn, or recommend XSLT? Asked 10 years, 3 months ago. Active 6 years, 4 months ago.

Viewed 26k times. Improve this question. SaravananArumugam SaravananArumugam 1 1 gold badge 4 4 silver badges 11 11 bronze badges. Relavent reading: harmful. To me, XSLT is a horribly cryptic programming language in denial of being a programming language. It's related to pure functional programming languages, but made much less readable, much less maintainable, much less practical. DocBook a complex piece of software written in the XSLT language have the problem of integrating the various interpreters, checkers, libraries etc.

JScript File test. Copy and paste the code into a file, and save it as test. Type the "test. Output The output is "Red apple". I now get an "undeclared reference to namespace prefix" error. What do I need to do to fix this? In this article.



0コメント

  • 1000 / 1000