-
Notifications
You must be signed in to change notification settings - Fork 19
XSL Templates
Ximdex is based on XML (eXtensible Markup Language). This language consists of a set of rules used to planning and producing structured text files.
Its main advantage is that it is a simple format, standard, extensible, besides not being tied to any private company, platform or programming language, making it ideal as a tool for communication and interoperability. XML is already widely used language that is a first step on the road to the ideal of the semantic web.
As HTML, XML language is based on tags or labels, that is, words in angle brackets ( < and > ), and attributes of the form:
name = "value"
But while in HTML each tag and attribute define a closed behavior, often associated with the appearance to be presented in a browser, XML uses the tags only to enter data, leaving the interpretation of the data to the application using the file.
Thus, for example, a label
in an XML file does not have to be a paragraph, it may be a price, a parameter, etc.. Another distinctive feature is that there is discrimination XML is case sensitive, i.e. <price> element differs from another <Price>.XML element means each of the pieces of information that make up an XML document, and has the general format:
<element attribute1=”value1” attribute2=”value2”>… content …</element>
We explain in detail each of its parts:
- Tags: They must always be enclosed in angle brackets ('<' and '>'). Always specify the closing tag, with the possibility of using an abbreviated syntax if the element has no content: attribute2="value2" attribute1="value1" . As a recommendation, the name chosen for the labels should be descriptive enough to easily identify the purpose of the item.
- Properties or attributes: They are additional information that is added to the XML element in its opening tag, always with the format attribute = "value", being obligatory quotes. You can add as many attributes as necessary.
- Content: It is what it is bounded between labels start and end of the XML element. In the simplest case is just unstructured text, but can also include other elements, and can reach a recursive hierarchical structure, which is what characterizes the XML language.
Finally, note that for considering a well-formed XML, there needs to be a single parent node that is the root of the whole structure.
The structure Ximdex Project Manager to work with independent projects. Each of the projects has a repository Ximdex transformation templates (XSL templates) common to the different servers contained in each project. These templates are stored in the folder ximptd. To become more familiar with the interface Ximdex please read the manual interface description Ximdex.
Also, a server node within each project can contain different levels Ximdex (or sections) where sorting and organizing information, for hierarchical directories of a filesystem.
[Image1]
Each of these levels contains a folder with XML documents that make up the information (ximdoc folder) and another folder where you store your own XSL templates that level (ximptd too).
RNG visualization templates are stored in the folder ximpvd that is unique for each project. This folder contains files with the. Xml structures that define our documents. We have as many as different documents we handle in our portal.
The Ximdex transformation engine is responsible for process and convert XML documents contained in Ximdex, generating an output in the format selected by the user. Use for this transformation templates specified within the document level or, alternatively, that falls in the common folder to the project.
Ximdex manages XML documents optimally preparing for its future transformations are fast and instant. Therefore, to begin the process of transformation (whether to render the document in the XML editor for publication or production servers) adds a unique label at the beginning of the XML document to add a number of additional attributes to our content. This label is the label .
For example, the label could be:
The additional benefit of adding this label is that we can stop worrying XML document format that we are creating. As discussed in section 1.2 of this document, the XML schema requires that there be a parent node and unique to each document to be considered well-formed XML. The label will act as as parent node of all our documents in Ximdex.
To view our label attached document that we just have to access the path <XIMDEX_HOME> / data / nodes /, where <XIMDEX_HOME> represents the path where you have installed on your machine Ximdex. In that directory will find the very structure of our project in Ximdex overturned the file system and all files structured (which we store in the folder ximdoc) are labeled added.
Before commenting on the document transformation process conducted in Ximdex, let's consider template_include.xsl file.
This template simply contains a list of all existing XSL templates in the section to which it belongs. It aims to unite the inclusion of all XSL that exist in that section and that may be involved in the transformation.
Your content could be something like this:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:include href="parrafo.xsl"/> <xsl:include href="lista.xsl"/> ... </xsl:stylesheet>
His generation is automatic whenever climbed a XSL template section, so we should not worry about keeping it.
This template is referenced in the template docxap.xsl (not to be confused with the label ) as follows:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:include href="http://myserver.com/<Ximdex_Home>/data/nodes/ruta/a/ximptd/templates_include.xsl"/> <xsl:template name="docxap" match="docxap"> </xsl:template> </xsl:stylesheet>
The basic logic that follows the Ximdex transformation engine when processing an XML document and apply the templates is:
-
The XML document starts reading from the beginning, sequentially. The first label or root element is always , so the first team to run will docxap.xsl. This is the only fixed label Ximdex driving, leaving the rest of the user's choice.
-
Finding an XML tag search engine an XSL template in the folder ximptd the same level as the document with the same name as the element found. If not found, look in the folder common ximptd project.
-
Once located the template processing, the output engine replaces the contents of the XML tag for the content of the template transformation.
-
This process is repeated recursively until the treatment end of the XML document.