| 2 |
|
|
| 3 |
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> |
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> |
| 4 |
|
|
| 5 |
<!-- |
<!-- |
| 6 |
|
|
| 7 |
|
xupdate2xsl: Translate XML document from namespace 'xupdate' to 'xsl'. |
| 8 |
|
|
| 9 |
Purpose of this XML Stylesheet is to implement a set of templates |
Purpose of this XML Stylesheet is to implement a set of templates |
| 10 |
to translate XUpdate lingo into an intermediate xslt stylesheet |
to translate XUpdate lingo into an intermediate xslt stylesheet |
| 11 |
which actually performs the update to the original xml document |
which actually performs the update to the original xml document |
| 12 |
in a second step. |
in a second step. |
| 13 |
|
|
| 14 |
The required glue code - written in Perl - is available in module |
The required glue code - written in Perl - is available in module |
| 15 |
XML::XUpdate::XSLT. Please have a look at this to port it to other |
XML::XUpdate::XSLT. Please have a look at this in order to use |
| 16 |
languages. |
this stylesheet from other bindings. |
| 17 |
|
|
| 18 |
--> |
--> |
| 19 |
|
|
| 20 |
<xsl:output method="xml" /> |
<xsl:output method="xml" /> |
| 59 |
<xsl:element name="xsl:copy"><xsl:element name="xsl:apply-templates" /></xsl:element> |
<xsl:element name="xsl:copy"><xsl:element name="xsl:apply-templates" /></xsl:element> |
| 60 |
</xsl:element> |
</xsl:element> |
| 61 |
<xsl:element name="xsl:template"> |
<xsl:element name="xsl:template"> |
| 62 |
<xsl:attribute name="match">*</xsl:attribute> |
<!-- <xsl:attribute name="match">*</xsl:attribute> --> |
| 63 |
|
<xsl:attribute name="match">*ab</xsl:attribute> |
| 64 |
<xsl:element name="xsl:call-template"><xsl:attribute name="name">passthru</xsl:attribute></xsl:element> |
<xsl:element name="xsl:call-template"><xsl:attribute name="name">passthru</xsl:attribute></xsl:element> |
| 65 |
</xsl:element> |
</xsl:element> |
| 66 |
<xsl:element name="xsl:template"> |
<xsl:element name="xsl:template"> |
| 79 |
|
|
| 80 |
<!-- code --> |
<!-- code --> |
| 81 |
<!-- This node "encapsulates" infrastructure for handling the directives. --> |
<!-- This node "encapsulates" infrastructure for handling the directives. --> |
| 82 |
<!-- FIXME: handle the other ones: append, remove, ect. --> |
<!-- FIXME: handle the other ones: append, remove, etc. --> |
| 83 |
<xsl:template match="xupdate:insert-after"> |
<xsl:template match="xupdate:insert-after"> |
| 84 |
<xsl:comment> 2. context finder </xsl:comment> |
<xsl:comment> 2. context finder </xsl:comment> |
| 85 |
<!-- <xsl:variable name="select" select="@select">Hello World!</xsl:variable> --> |
<!-- <xsl:variable name="select" select="@select">Hello World!</xsl:variable> --> |
| 92 |
|
|
| 93 |
<!-- V2 --> |
<!-- V2 --> |
| 94 |
<xsl:element name="xsl:template"> |
<xsl:element name="xsl:template"> |
| 95 |
<!-- <xsl:attribute name="match">*</xsl:attribute> --> |
<xsl:attribute name="match">*</xsl:attribute> |
| 96 |
<xsl:attribute name="match">/addresses/address</xsl:attribute> |
<!-- <xsl:attribute name="match">/addresses/address</xsl:attribute> --> |
| 97 |
|
<!-- <xsl:attribute name="match"><xsl:value-of select="@select" /></xsl:attribute> --> |
| 98 |
|
|
| 99 |
<xsl:element name="xsl:choose"> |
<xsl:element name="xsl:choose"> |
| 100 |
<!-- <xsl:attribute name="match"><xsl:value-of select="@select" /></xsl:attribute> --> |
<!-- <xsl:attribute name="match"><xsl:value-of select="@select" /></xsl:attribute> --> |
| 101 |
<xsl:element name="xsl:when"> |
<xsl:element name="xsl:when"> |
| 102 |
|
<!-- <xsl:attribute name="test"><xsl:value-of select="@test" /></xsl:attribute> --> |
| 103 |
<xsl:attribute name="test"><xsl:value-of select="@select" /></xsl:attribute> |
<xsl:attribute name="test"><xsl:value-of select="@select" /></xsl:attribute> |
| 104 |
|
|
| 105 |
<!-- insert-before!!! --> |
<!-- FIXME: case "insert-before"!!! --> |
| 106 |
<!-- <xsl:apply-templates /> --> |
<!-- <xsl:apply-templates /> --> |
| 107 |
|
|
| 108 |
<!-- call the "identity template rule" to passthru all childnodes --> |
<!-- call the "identity template rule" to passthru all childnodes --> |
| 109 |
<xsl:element name="xsl:call-template"> |
<xsl:element name="xsl:call-template"> |
| 110 |
<xsl:attribute name="name">identity_template_rule</xsl:attribute> |
<xsl:attribute name="name">identity_template_rule</xsl:attribute> |
| 111 |
|
<!-- <xsl:attribute name="name">passthru</xsl:attribute> --> |
| 112 |
</xsl:element> |
</xsl:element> |
| 113 |
|
|
| 114 |
<!-- insert-after!!! --> |
<!-- FIXME: case "insert-after"!!! --> |
| 115 |
<xsl:apply-templates /> |
<xsl:apply-templates /> |
| 116 |
|
|
| 117 |
</xsl:element> |
</xsl:element> |
| 120 |
<!-- call the "identity template rule" to passthru all childnodes --> |
<!-- call the "identity template rule" to passthru all childnodes --> |
| 121 |
<xsl:element name="xsl:call-template"> |
<xsl:element name="xsl:call-template"> |
| 122 |
<xsl:attribute name="name">identity_template_rule</xsl:attribute> |
<xsl:attribute name="name">identity_template_rule</xsl:attribute> |
| 123 |
|
<!-- <xsl:attribute name="name">passthru</xsl:attribute> --> |
| 124 |
</xsl:element> |
</xsl:element> |
| 125 |
|
|
| 126 |
|
<!-- <xsl:apply-templates /> --> |
| 127 |
|
|
| 128 |
</xsl:element> |
</xsl:element> |
| 129 |
|
|
| 130 |
</xsl:element> |
</xsl:element> |