View File | Revision Log | Show Annotations | Download File | View Changeset
/hippo/hippo-documentation/hst_docs/trunk/scripts/wiki2doc.xsl
(Generate patch)

Comparing hippo-documentation/hst_docs/trunk/scripts/wiki2doc.xsl (file contents):
Revision 21416 by rbijlsma, Thu Jan 14 17:03:06 2010 UTC vs.
Revision 21417 by rbijlsma, Tue Jan 26 17:00:05 2010 UTC

23 xmlns:hippostd="http://www.onehippo.org/jcr/hippostd/nt/2.0" 23 xmlns:hippostd="http://www.onehippo.org/jcr/hippostd/nt/2.0"
24 xmlns:hippo="http://www.onehippo.org/jcr/hippo/nt/2.0" 24 xmlns:hippo="http://www.onehippo.org/jcr/hippo/nt/2.0"
25 xmlns:h='http://www.w3.org/1999/xhtml' 25 xmlns:h='http://www.w3.org/1999/xhtml'
26 > 26 >
27 27
28<xsl:param name='filename' select='"unnamed_doc"'/> 28<xsl:include href="basic2doc.xsl"/>
29
30<xsl:variable name='docname' select='translate($filename, "+", "_")'/>
31
32 29
33<xsl:output 30<xsl:output
34 method="xml" 31 method="xml"
35 encoding="UTF-8" 32 encoding="UTF-8"
36 indent="yes" 33 indent="yes"
45 <xsl:call-template name='fulldoc'/> 42 <xsl:call-template name='fulldoc'/>
46 </xsl:for-each> 43 </xsl:for-each>
47 </s:list> 44 </s:list>
48</xsl:template> 45</xsl:template>
49 46
50<!-- _______________________________________________________-->
51<xsl:template match="h:*" mode='value'>
52 <xsl:variable name='name' select='concat("h:", local-name())'/>
53 <xsl:element name='{$name}'>
54 <xsl:apply-templates select='@*|node()' mode='value'/>
55 </xsl:element>
56</xsl:template>
57
58<!-- _______________________________________________________-->
59<xsl:template name="fulldoc">
60 <xsl:param name='name' select='$docname'/>
61
62 <xsl:element name='{$name}'>
63 <xsl:attribute name='jcr:primaryType'>hippo:handle</xsl:attribute>
64 <xsl:attribute name='jcr:mixinTypes'>hippo:hardhandle</xsl:attribute>
65 <xsl:attribute name='jcr:uuid'>412ca52e-dc7e-4969-b9fe-89411bb48b93</xsl:attribute>
66 <s:list elem="property"/>
67 <xsl:element name='{$name}'>
68 <xsl:attribute name='hippostd:holder'>admin</xsl:attribute> <!-- TODO Verander naar wiki? Als rest gelukt. -->
69 <xsl:attribute name='hippostd:state'>unpublished</xsl:attribute>
70 <xsl:attribute name='hippostd:stateSummary'>new</xsl:attribute>
71 <xsl:attribute name='jcr:primaryType'>docs:full</xsl:attribute>
72 <xsl:attribute name='jcr:mixinTypes'>hippo:harddocument</xsl:attribute>
73 <xsl:attribute name='jcr:uuid'>5c04ef5f-1006-4692-9974-c2b00826936a</xsl:attribute>
74 <s:list elem="property">
75 <docs:audience count='any'/>
76 <docs:component count='any'/>
77 <docs:difficulty>@empty@</docs:difficulty>
78 <docs:expire_version>@empty@</docs:expire_version>
79 <docs:new_in_version>@empty@</docs:new_in_version>
80 <docs:title><xsl:apply-templates mode='title' select='h:h1/h:a/node()'/></docs:title> <!-- TODO: if not found, then no @empty@ so no sv:value, so is invalid in jcr. Now added space. -->
81 <docs:type>Howto</docs:type>
82 <docs:written_for_version>@empty@</docs:written_for_version>
83 </s:list>
84 <docs:short_description/>
85 <docs:goal/>
86 <docs:intro>
87 <h:html><h:body>
88 <xsl:for-each select='key("sectioncontent", generate-id(h:h2[text()="Introduction"][1]))'>
89 <xsl:apply-templates/>
90 </xsl:for-each>
91 </h:body></h:html>
92 </docs:intro>
93 <xsl:variable name='sectiontitles' select='h:h2[text()!="Introduction"]'/>
94 <xsl:for-each select='$sectiontitles'>
95 <docs:section jcr:primaryType="docs:section">
96 <s:list elem="property">
97 <docs:title><xsl:apply-templates mode='title' select='*[not(self::a)]|text()'/></docs:title> <!-- Added space -->
98 <docs:todo/>
99 </s:list>
100 <docs:intro/>
101 <!--
102 <docs:one_step jcr:primaryType="docs:step">
103 <s:list elem="property">
104 <docs:category>category</docs:category>
105 <docs:name>Step name</docs:name>
106 </s:list>
107 <docs:icon jcr:primaryType="hippo:facetselect" hippo:docbase="d6f70acd-3f4d-4943-b1f1-dd3c6a599937" hippo:facets="" hippo:modes="" hippo:values="">
108 <s:list elem="property"/>
109 </docs:icon>
110 <docs:explanation><h:html><h:body>TODO</h:body></h:html></docs:explanation>
111 </docs:one_step>
112 <docs:one_screenshot jcr:primaryType="docs:screenshot">
113 <s:list elem="property">
114 <docs:alt>@empty@</docs:alt>
115 <docs:bottompx>@empty@</docs:bottompx>
116 <docs:heightpx>@empty@</docs:heightpx>
117 <docs:leftpx>@empty@</docs:leftpx>
118 <docs:new_in_version>@empty@</docs:new_in_version>
119 <docs:toppx>@empty@</docs:toppx>
120 <docs:widthpx>@empty@</docs:widthpx>
121 </s:list>
122 <docs:imagelink jcr:primaryType="hippo:facetselect" hippo:docbase="cafebabe-cafe-babe-cafe-babecafebabe" hippo:facets="" hippo:modes="" hippo:values="">
123 <s:list elem="property"/>
124 </docs:imagelink>
125 <docs:caption><h:html><h:body>TODO</h:body></h:html></docs:caption>
126 </docs:one_screenshot>
127 -->
128 <docs:closing><h:html><h:body>
129<xsl:apply-templates mode='value' select='key("sectioncontent", generate-id(.))'/>
130</h:body></h:html></docs:closing>
131 </docs:section>
132</xsl:for-each>
133
134<!--
135 <docs:next jcr:primaryType="docs:link">
136 <s:list elem="property">
137 <docs:description>Next document description</docs:description>
138 <docs:url>@empty@</docs:url>
139 </s:list>
140 <docs:documentlink jcr:primaryType="hippo:facetselect" hippo:docbase="cafebabe-cafe-babe-cafe-babecafebabe" hippo:facets="" hippo:modes="" hippo:values="">
141 <s:list elem="property"/>
142 </docs:documentlink>
143 </docs:next>
144 <docs:alternative jcr:primaryType="docs:link">
145 <s:list elem="property">
146 <docs:description>Alternative document description</docs:description>
147 <docs:url>@empty@</docs:url>
148 </s:list>
149 <docs:documentlink jcr:primaryType="hippo:facetselect" hippo:docbase="cafebabe-cafe-babe-cafe-babecafebabe" hippo:facets="" hippo:modes="" hippo:values="">
150 <s:list elem="property"/>
151 </docs:documentlink>
152 </docs:alternative>
153 -->
154 </xsl:element>
155 </xsl:element>
156</xsl:template>
157
158<!-- ___________________________________________________________________________________________ -->
159 <xsl:template match="@*|node()[not(self::*)]">
160 <xsl:copy/>
161 </xsl:template>
162
163
164<!-- _______________________________________________________ -->
165 <xsl:template match="*">
166 <xsl:copy>
167 <xsl:apply-templates select="@*|node()"/>
168 </xsl:copy>
169 </xsl:template>
170
171</xsl:transform> 47</xsl:transform>
172 48

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines