/[cvs]/nfo/perl/libs/XML/XUpdate/xupdate2xsl.xml
ViewVC logotype

Contents of /nfo/perl/libs/XML/XUpdate/xupdate2xsl.xml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (show annotations)
Thu May 1 20:39:54 2003 UTC (21 years ago) by joko
Branch: MAIN
File MIME type: text/xml
initial commit, extracted from XML::XUpdate::XSLT.

1 <?xml version="1.0" encoding="ISO-8859-1"?>
2
3 <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
4
5 <!--
6 Purpose of this XML Stylesheet is to implement a set of templates
7 to translate XUpdate lingo into an intermediate xslt stylesheet
8 which actually performs the update to the original xml document
9 in a second step.
10 The required glue code - written in Perl - is available in module
11 XML::XUpdate::XSLT. Please have a look at this to port it to other
12 languages.
13 -->
14
15 <xsl:output method="xml" />
16
17 <!-- 1. This is the passthru logic (copy all untouched nodes). -->
18 <xsl:template name="passthru"><xsl:copy><xsl:apply-templates /></xsl:copy></xsl:template>
19 <!-- activate this -->
20 <xsl:template match="*"><xsl:call-template name="passthru" /></xsl:template>
21 <!-- override some builtin rules: see http://www.w3.org/TR/xslt#built-in-rule -->
22 <xsl:template match="comment()"><xsl:call-template name="passthru" /></xsl:template>
23
24 <!-- 2. This is the translation part: XUpdate becomes XSLT -->
25
26 <!-- This node "encapsulates" common infrastructure. -->
27 <xsl:template match="xupdate:modifications">
28
29 <!-- 1. This is the passthru logic (copy all untouched nodes). -->
30 <!-- in fact this is the xsl from above translated to be able to be generated by xsl itself! -->
31 <xsl:comment> 1. passthru logic </xsl:comment>
32 <xsl:element name="xsl:template">
33 <xsl:attribute name="name">passthru</xsl:attribute>
34 <xsl:element name="xsl:copy"><xsl:element name="xsl:apply-templates" /></xsl:element>
35 </xsl:element>
36 <xsl:element name="xsl:template">
37 <xsl:attribute name="match">*</xsl:attribute>
38 <xsl:element name="xsl:call-template"><xsl:attribute name="name">passthru</xsl:attribute></xsl:element>
39 </xsl:element>
40 <xsl:element name="xsl:template">
41 <xsl:attribute name="match">comment()</xsl:attribute>
42 <xsl:element name="xsl:call-template"><xsl:attribute name="name">passthru</xsl:attribute></xsl:element>
43 </xsl:element>
44
45 <!-- continue with all inline nodes -->
46 <xsl:apply-templates />
47
48 </xsl:template>
49
50 <!-- This node "encapsulates" infrastructure for handling the directives. -->
51 <xsl:template match="xupdate:insert-after">
52 <xsl:comment> 2. context finder </xsl:comment>
53 <xsl:apply-templates />
54 </xsl:template>
55
56 <!-- This node passes through all attributes and childnodes rewriting the tagname only. -->
57 <xsl:template match="xupdate:element">
58 <xsl:comment> 3. rewrite / vivify elements/attributes </xsl:comment>
59 <xsl:element name="xsl:element">
60 <xsl:copy-of select="@*"/>
61 <xsl:apply-templates />
62 </xsl:element>
63 </xsl:template>
64
65 <!-- This node passes through all attributes and childnodes rewriting the tagname only. -->
66 <xsl:template match="xupdate:attribute">
67 <xsl:element name="xsl:attribute">
68 <xsl:copy-of select="@*"/>
69 <xsl:apply-templates />
70 </xsl:element>
71 </xsl:template>
72
73 </xsl:stylesheet>
74

MailToCvsAdmin">MailToCvsAdmin
ViewVC Help
Powered by ViewVC 1.1.26 RSS 2.0 feed