| 1 | <?xml version="1.0" encoding="UTF-8"?>
|
|---|
| 2 | <!--
|
|---|
| 3 | ###############################################################################
|
|---|
| 4 | # format.xsl :: Format to human readable style #
|
|---|
| 5 | # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ #
|
|---|
| 6 | # o with XML declaration #
|
|---|
| 7 | # o attributes and nodes copied #
|
|---|
| 8 | # o indentation used #
|
|---|
| 9 | ###############################################################################
|
|---|
| 10 | -->
|
|---|
| 11 |
|
|---|
| 12 | <!-- Start of this transform-sheet -->
|
|---|
| 13 | <xsl:transform
|
|---|
| 14 | id="a60d6d1f-16bd-4340-87f4-bdaab7695a38"
|
|---|
| 15 | version="1.0"
|
|---|
| 16 | xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
|---|
| 17 | >
|
|---|
| 18 |
|
|---|
| 19 | <!-- Output Parameters -->
|
|---|
| 20 | <xsl:output
|
|---|
| 21 | method="xml"
|
|---|
| 22 | version="1.0"
|
|---|
| 23 | encoding="UTF-8"
|
|---|
| 24 | omit-xml-declaration="no"
|
|---|
| 25 | indent="yes"
|
|---|
| 26 | cdata-section-elements=""
|
|---|
| 27 | media-type="text/xml"
|
|---|
| 28 | />
|
|---|
| 29 |
|
|---|
| 30 | <!-- We do want to preserve space when processing ODT-content -->
|
|---|
| 31 | <xsl:preserve-space elements="*" />
|
|---|
| 32 |
|
|---|
| 33 | <!-- Process all attributes and nodes -->
|
|---|
| 34 | <xsl:template match="@*|node()">
|
|---|
| 35 | <xsl:copy>
|
|---|
| 36 | <xsl:apply-templates select="@*|node()" />
|
|---|
| 37 | </xsl:copy>
|
|---|
| 38 | </xsl:template>
|
|---|
| 39 |
|
|---|
| 40 |
|
|---|
| 41 | <!--
|
|---|
| 42 | @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
|---|
| 43 | @@
|
|---|
| 44 | @@ MATCH THE DOCUMENT ROOT
|
|---|
| 45 | @@ ____________________________________________________________________________
|
|---|
| 46 | @@
|
|---|
| 47 | @@ A match on '/' matches the *document-root* and not the *root-element*.
|
|---|
| 48 | @@ This means there is no current node yet and everything emitted here would
|
|---|
| 49 | @@ precede the content emitted by processing the root-element.
|
|---|
| 50 | @@
|
|---|
| 51 | @@ To have more control over over the general transformation, the real
|
|---|
| 52 | @@ processing is delegated to a named template. This allows easy switching to
|
|---|
| 53 | @@ another named template with different processing rules.
|
|---|
| 54 | @@
|
|---|
| 55 | @@ Named templates can be regarded as library templates.
|
|---|
| 56 | @@ To separate the 'matching' part from the 'library' part, named templates
|
|---|
| 57 | @@ are located *below* this initial matching of the document root.
|
|---|
| 58 | @@
|
|---|
| 59 | @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
|
|---|
| 60 | -->
|
|---|
| 61 | <xsl:template match="/">
|
|---|
| 62 | <xsl:call-template name="main" />
|
|---|
| 63 | </xsl:template>
|
|---|
| 64 |
|
|---|
| 65 |
|
|---|
| 66 | <!--
|
|---|
| 67 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|---|
| 68 | %% Main operations variant
|
|---|
| 69 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|---|
| 70 | -->
|
|---|
| 71 | <xsl:template name="main">
|
|---|
| 72 | <xsl:call-template name="header" />
|
|---|
| 73 | <xsl:call-template name="format" />
|
|---|
| 74 | </xsl:template>
|
|---|
| 75 |
|
|---|
| 76 |
|
|---|
| 77 | <!--
|
|---|
| 78 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|---|
| 79 | %% The header for this generated document
|
|---|
| 80 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|---|
| 81 | -->
|
|---|
| 82 | <xsl:template name="header">
|
|---|
| 83 | <xsl:comment>!! GENERATED DOCUMENT !!</xsl:comment>
|
|---|
| 84 | <xsl:comment>
|
|---|
| 85 | ###############################################################################
|
|---|
| 86 | # A processed version for human readability ~~ Not used for input !
|
|---|
| 87 | # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|---|
| 88 | #
|
|---|
| 89 | # The original 'content.xml' is one long line, which is needed to preserve all
|
|---|
| 90 | # white space and don't let newlines and indentation interfere. With regard to
|
|---|
| 91 | # the elements in 'content.xml', there are many which are simply empty because
|
|---|
| 92 | # they are 'left overs' from previous formatting actions done by the user when
|
|---|
| 93 | # editing the ODT document with AOO Writer. Also, Writer, in many cases,
|
|---|
| 94 | # generates a temporary style with a user-defined custom style as its parent.
|
|---|
| 95 | # Such temporary styles need to be tracked down to their parent to see if this
|
|---|
| 96 | # is one of the 'ipf-*' custom styles, so the correct IPF markup can be
|
|---|
| 97 | # generated.
|
|---|
| 98 | #
|
|---|
| 99 | # This generated content helps in examining the parts of interest.
|
|---|
| 100 | #
|
|---|
| 101 | ###############################################################################
|
|---|
| 102 | </xsl:comment>
|
|---|
| 103 | </xsl:template>
|
|---|
| 104 |
|
|---|
| 105 |
|
|---|
| 106 | <!--
|
|---|
| 107 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|---|
| 108 | %% Produce a human readable version of the input-document
|
|---|
| 109 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|---|
| 110 | -->
|
|---|
| 111 | <xsl:template name="format">
|
|---|
| 112 | <xsl:apply-templates select="@*|node()" />
|
|---|
| 113 | </xsl:template>
|
|---|
| 114 |
|
|---|
| 115 | </xsl:transform>
|
|---|