Ejecutable which xsltproc no




















Sign up using Facebook. Sign up using Email and Password. Post as a guest Name. Email Required, but never shown. The Overflow Blog. Does ES6 make JavaScript frameworks obsolete? Podcast Do polyglots have an edge when it comes to mastering programming Featured on Meta. Now live: A fully responsive profile. Related Hot Network Questions.

Question feed. You need system administration privileges root to install packages. Then commands such as these should work:. Then try xsltproc -version to see if it reports the new version number. If you cannot find a precompiled version of xsltproc for your platform, or if you want the very latest version, then you can compile it yourself from source.

It is pretty easy to compile xslproc if you use the GNU compiler. That compiler is generally available on all Linux distributions, and is also available for many Unix systems.

It is even available for Cygwin a Linux environment that runs on Windows. You might need to search the Internet to find one for your system if it does not already have one. To run the xsltproc processor, you need the libxml2 and libxslt packages, the ones with the highest version numbers. Then do the following:. You will need to have root permission to run the install step. If these steps proceed without error, you should be able to run this command to test it:. If you get a Command Not Found error message, then you need to find where xsltproc is installed and add that location to your PATH environment variable.

To use xsltproc, you specify the location of the main stylesheet file and your DocBook document, as well as any options and parameters:. You can place any options such as --output after xsltproc. You can use any number of --stringparam options to pass stylesheet parameter values on the command line, in this case setting the parameter named use.

If a parameter value includes spaces or special characters, put it in quotes. It is a graphical interface to xsltproc that lets you browse for filenames and set options and parameters. Currently Saxon is available in four packages:. It runs on any Java-capable system, and provides opportunities for adding extensions.

It is probably the most commonly used Saxon package, and is the version used in the examples in this book. The Instant Saxon processor is a precompiled version of Saxon 6. It is under active development, as are several of the standards that it implements. This is the commercial version of Saxon 8. That optional step is included here too. So your system must have a Java processing environment for it to work. Java version 1. You can find out which Java is on your system by executing java -version.

If you get Command not found then you may not have Java installed on the system, or it may not be in your PATH environment variable. Java version numbering has evolved over the years. The following table lists past and current Java versions:. The Java runtime system is available for download from Sun Microsystems, Inc. If you have a different platform UNIX or Mac, for instance , then you need to contact your OS vendor to see if they make available an up-to-date Java runtime environment.

Saxon is distributed as a zip file, so you need to unzip it into some suitable location. It can be a temporary location because you can move the few files you really need to a new location. To run Saxon, you only need to tell your Java processor where the Saxon.

There are three files in the directory you unpacked Saxon into:. You will not need saxon-fop. The DocBook stylesheets have some custom extension functions written specifically for the Saxon processor. These functions are contained in a saxon There may be several saxon jar files there, labeled by the version number of Saxon. Use the one closest to your Saxon version number. You want the Xerces2 Java parser. The web page has a link to where you can download just the latest jar file, xercesImpl.

Put the file in a convenient location. You need to include the full path to the necessary. That environment variable is used by the Java processor to locate compiled code used by Java programs.

You can copy the. If it does not already exist in the list, then select New. Each path should be a full path to one of the required. For example:. If you are already in a DOS window, you will need to exit and restart it for the new environment variable to take effect. This should report the version of Saxon that you have installed, as well as usage and command options.

Saxon is a Java application that is executed from a command line. In order for the command to find all the Java code it needs, you must add the Java. Once you have done that, then you execute the java command as follows. The backslashes mean the line continues without break, but is shown here on separate lines for clarity. Note that the XML document name precedes the stylesheet path in a Saxon command line.

You can put any Saxon options such as -o before the document filename. You can also set any number of stylesheet parameters such as use. See Chapter 6, Using stylesheet parameters for details on using parameters. An imported stylesheet has a parent link to allow browsing of the tree.

The DOM tree associated to the document is stored in doc. It is preprocessed to remove ignorable empty nodes and all the nodes in the XSLT namespace are subject to precomputing. A couple of notable exceptions to this are XSLT template nodes more on this later and attribute value templates. If they are actually templates, the value cannot be computed at compilation time.

Some preprocessing could be done like isolation and preparsing of the XPath subexpressions but it's not done, yet. A proper handling of templates lookup is one of the keys of fast XSLT processing. Given a node in the source document this is the process of finding which templates should be applied to this node. Libxslt follows the hint suggested in the 5.

There usually is an indication of the node name in the last step of this evaluation and this is used as a key check for the match. As a result libxslt builds a relatively more complex set of structures for the templates:.

Let's describe a bit more closely what is built. First the xsltStylesheet structure holds a pointer to the template hash table. All the XSLT patterns compiled in this stylesheet are indexed by the value of the the target element or attribute, pi Each of the patterns is compiled into an xsltCompMatch i.

It holds the set of rules based on the tokenization of the pattern stored in reverse order matching is easier this way. The xsltCompMatch are then stored in the hash table, the clash list is itself sorted by priority of the template to implement "naturally" the XSLT priority rules.

Associated to the compiled pattern is the xsltTemplate itself containing the information required for the processing of the pattern including, of course, a pointer to the list of elements used for building the pattern result. Last but not least a number of patterns do not fit in the hash table because they are not associated to a name, this is the case for patterns applying to the root, any element, any attributes, text nodes, pi nodes, keys etc.

Those are stored independently in the stylesheet structure as separate linked lists of xsltCompMatch. The processing is defined by the XSLT specification the basis of the algorithm is explained in the Introduction section. Basically it works by taking the root of the input document as the cureent node and applying the following algorithm:. The closure is usually done through the XSLT apply-templates construct, which invokes this process recursively starting at step 1, to find the appropriate template for the nodes selected by the 'select' attribute of the apply-templates instruction default: the children of the node currently being processed.

Note that large parts of the input tree may not be processed by a given stylesheet and that conversely some may be processed multiple times. This often is the case when a Table of Contents is built. The module transform. Then a new document gets allocated HTML or XML depending on the type of output , the user parameters and global variables and parameters are evaluated.

Then xsltProcessOneNode which implements the algorithm is called on the docuemnt node of the input. The XPath support is actually implemented in the libxml module where it is reused by the XPointer implementation. XPath is a relatively classic expression language. The only uncommon feature is that it is working on XML trees and hence has specific syntax and types to handle them. XPath expressions are compiled using xmlXPathCompile.

It will take an expression string in input and generate a structure containing the parsed expression tree, for example the expression:. This can be tested using the testXPath command in the libxml codebase using the --tree option. Again, the KISS approach is used. No optimization is done. This could be an interesting thing to add.

Michael Kay describes a lot of possible and interesting optimizations done in Saxon which would be possible at this level. I'm unsure they would provide much gain since the expressions tends to be relatively simple in general and stylesheets are still hand generated. Optimizations at the interpretation sounds likely to be more efficient.

This evaluation follows the KISS approach again. An evaluation is done within the framework of an XPath context stored in an xmlXPathContext structure, in the framework of a transformation the context is maintained within the XSLT context. Its content follows the requirements from the XPath specification:. When an XPath evaluation is about to be performed, an XPath parser context is allocated containing an XPath object stack this is actually an XPath evaluation context, this is a relic of the time where there was no separate parsing and evaluation phase in the XPath implementation.

Clearly this is a bit too complex and confusing and should be refactored at the next set of binary incompatible releases of libxml. An XPath expression manipulates XPath objects. XPath defines the default types boolean, numbers, strings and node sets. XSLT adds the result tree fragment type which is basically an unmodifiable node set.

Implementation-wise, libxml follows again a KISS approach, the xmlXPathObject is a structure containing a type description and the various possibilities. Using an enum could have gained some bytes. In the case of node sets or result tree fragments , it points to a separate xmlNodeSet object which contains the list of pointers to the document nodes:.

All the XPath functions available to the interpreter are registered in the function hash table linked from the XPath context. They all share the same signature:. The first argument is the XPath interpretation context, holding the interpretation stack.

The second argument defines the number of objects passed on the stack for the function to consume last argument is on top of the stack. Not to be confused with XPath object stack, this stack holds the XSLT variables and parameters as they are defined through the recursive calls of call-template, apply-templates and default templates. This is used to define the scope of variables being called. This part seems to be one needing most work , first it is done in a very inefficient way since the location of the variables and parameters within the stylesheet tree is still done at run time it really should be done statically at compile time , and I am still unsure that my understanding of the template variables and parameter scope is actually right.

This part of the documentation is still to be written once this part of the code will be stable. There is a separate document explaining how the extension support works.

Michael Kay wrote a really interesting article on Saxon internals and the work he did on performance issues. I wish I had read it before starting libxslt design I would probably have avoided a few mistakes and progressed faster. A lot of the ideas in his papers should be implemented or at least tried in libxslt. Far too much work is done at execution time.



0コメント

  • 1000 / 1000