OSDN Git Service

Version 0.6.58, X.UI.HBox is working.
[pettanr/clientJs.git] / test / XmlXsltTest / pettanr.xsl
1 <?xml version="1.0" encoding="UTF-8"?>\r
2 <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" \r
3     xmlns="http://www.w3.org/1999/xhtml"> \r
4     <xsl:output \r
5         omit-xml-declaration="no" \r
6         encoding="utf-8" \r
7         method="html" \r
8         version="1.0" \r
9         doctype-public="-//W3C//DTD HTML 4.01 Transitional//EN" \r
10         doctype-system="http://www.w3.org/TR/html4/loose.dtd" \r
11         indent="yes" /> \r
12     <xsl:template match="/">\r
13         <xsl:apply-templates/>\r
14     </xsl:template>\r
15 \r
16 <xsl:template match="comic">\r
17         <html>\r
18                 <head>\r
19                         <meta http-equiv="content-type" content="text/html; charset=UTF-8" />\r
20                         <meta http-equiv="Content-Style-Type" content="text/css" />\r
21                         <meta http-equiv="imagetoolbar" content="no" />\r
22                                         \r
23                         <title>\r
24                     <xsl:if test="@subtitle">\r
25                         <xsl:value-of select="concat(@episode,' | ')"/>\r
26                     </xsl:if>\r
27                                 <xsl:value-of select="@title" />\r
28                     <xsl:if test="@author">\r
29                         <xsl:value-of select="concat(' | ',@author)"/>\r
30                     </xsl:if>\r
31                         </title>\r
32         \r
33                         <link href="pettanr.css" rel="stylesheet" type="text/css" />\r
34         \r
35                 </head>\r
36                 <body>\r
37                         <h1><xsl:value-of select="@title" /></h1>\r
38                         <h2><xsl:value-of select="@episode" /></h2>\r
39                         <p class='author'>author:<xsl:value-of select="@author" /></p>\r
40                         \r
41                         <div id="panelContainer">\r
42                                 <xsl:attribute name="style">\r
43                                         <xsl:value-of select="concat('width:',@w,'px;')"/>\r
44                                 </xsl:attribute>\r
45                                 \r
46                                 <xsl:apply-templates/>\r
47                         </div>                  \r
48                         \r
49                         <div id="footer">\r
50                                 (c)<xsl:value-of select="/comic/@author" /> , flash publishing system 'pettan' is powered by pettan_dev.\r
51                         </div>\r
52                 </body>\r
53         </html>\r
54 </xsl:template>\r
55 \r
56     <xsl:template match="panel">\r
57         <div class="panel-wrapper">\r
58                         <xsl:for-each select=".">\r
59                                 <div class="panel">\r
60                                         <xsl:variable name="height" select="concat('height:',@h,'px;')" />\r
61                                         <xsl:variable name="bgcolor" select="concat('background-color:',@bgcolor,';')" />\r
62                                         <xsl:attribute name="style">\r
63                                                 <xsl:value-of select="concat($height,$bgcolor)"/>\r
64                                         </xsl:attribute>\r
65                                         <xsl:apply-templates/>\r
66                                 </div>\r
67                         </xsl:for-each>\r
68                         <xsl:for-each select="./picture">\r
69                                 <xsl:if test="@name">\r
70                                         \r
71                                         <div class="tooltip-container">\r
72                                                 <xsl:comment><![CDATA[[if lte IE 6]><a href="#"><table><tr><td><![endif]]]></xsl:comment>\r
73                                                 <img src="4x4.gif" class="image-shadow"><!-- 当初divで書いていたら、ie5.5~8で正しくレンダリングできない。なぜかDomが狂う、、、xsl:attribute name="style"が頭にきたせい? -->\r
74                                                         <xsl:attribute name="width">\r
75                                                                 <xsl:value-of select="@w"/>\r
76                                                         </xsl:attribute>\r
77                                                         <xsl:attribute name="height">\r
78                                                                 <xsl:value-of select="@h"/>\r
79                                                         </xsl:attribute>\r
80                                                         <xsl:attribute name="style">\r
81                                                                 <xsl:value-of select="concat('left:',@x,'px;','top:',@y,'px;')"/>\r
82                                                         </xsl:attribute>\r
83                                                 </img>\r
84                                                 <dl class="tooltip">\r
85                                                         <xsl:attribute name="style">\r
86                                                                 <xsl:value-of select="concat('margin-left:',position(),'9px;left:',/comic/@w,'px;','top:',@y,'px;')"/><!-- 要素が完全に重なることを防ぐためにposition()で要素のindexを取ってmargin-leftしている -->\r
87                                                         </xsl:attribute>\r
88                                                         <dt>作品名</dt>\r
89                                                         <dd><xsl:value-of select="@name" /></dd>\r
90                                                         <dt>作者</dt>\r
91                                                         <dd><xsl:value-of select="@author" /></dd>\r
92                                                         <dt>サイト</dt>\r
93                                                         <dd><xsl:value-of select="@site" /></dd>\r
94                                                 </dl>\r
95                                                 <xsl:comment><![CDATA[[if lte IE 6]></td></tr></table></a><![endif]]]></xsl:comment>\r
96                                         </div>\r
97                                         \r
98                                 </xsl:if>\r
99                         </xsl:for-each>\r
100                 </div>\r
101     </xsl:template>\r
102 \r
103     <xsl:template match="picture">\r
104                 <xsl:for-each select=".">\r
105                         <img>\r
106                                 <xsl:attribute name="src">\r
107                                         <xsl:value-of select="@url"/>\r
108                                 </xsl:attribute>\r
109                                 <xsl:attribute name="width">\r
110                                         <xsl:value-of select="@w"/>\r
111                                 </xsl:attribute>\r
112                                 <xsl:attribute name="height">\r
113                                         <xsl:value-of select="@h"/>\r
114                                 </xsl:attribute>\r
115                                 <xsl:variable name="left" select="concat('left:',@x,'px;')" />                          \r
116                                 <xsl:variable name="top" select="concat('top:',@y,'px;')" />    \r
117                                 <xsl:attribute name="style">\r
118                                         <xsl:value-of select="concat($left,$top)"/>\r
119                                 </xsl:attribute>\r
120                         </img>\r
121                 </xsl:for-each>         \r
122     </xsl:template>\r
123 \r
124     <xsl:template match="balloon">\r
125                 <xsl:for-each select=".">\r
126                         <img>\r
127                         <xsl:variable name="type">\r
128                             <xsl:if test="contains(@type,'0')">fukidasi/mfuki</xsl:if>\r
129                             <xsl:if test="contains(@type,'1')">fukidasi/omoiFuki</xsl:if>\r
130                         </xsl:variable>\r
131                                 <xsl:attribute name="src">\r
132                                         <xsl:value-of select="concat($type,@tail,'.gif')"/>\r
133                                 </xsl:attribute>\r
134                                 <xsl:attribute name="width">\r
135                                         <xsl:value-of select="@w"/>\r
136                                 </xsl:attribute>\r
137                                 <xsl:attribute name="height">\r
138                                         <xsl:value-of select="@h"/>\r
139                                 </xsl:attribute>\r
140                                 <xsl:variable name="left" select="concat('left:',@x,'px;')" />                  \r
141                                 <xsl:variable name="top" select="concat('top:',@y,'px;')" />\r
142                                 <xsl:attribute name="style">\r
143                                         <xsl:value-of select="concat($top,$left)"/>\r
144                                 </xsl:attribute>\r
145                         </img>\r
146                         \r
147                         <div class="speach">\r
148                                 <xsl:variable name="width" select="concat('width:',@w,'px;')" />                        \r
149                                 <xsl:variable name="height" select="concat('height:',@h,'px;')" />\r
150                                 <xsl:variable name="left2" select="concat('left:',@x,'px;')" />                 \r
151                                 <xsl:variable name="top2" select="concat('top:',@y,'px;')" />   \r
152                                 <xsl:variable name="fontsize">\r
153                             <xsl:if test="@size">\r
154                                 <xsl:value-of select="concat('font-size:',@size,'px;')"/>\r
155                             </xsl:if>\r
156                                 </xsl:variable>\r
157                                 <xsl:variable name="fontbold">\r
158                             <xsl:if test="@bold">font-weight:bold;</xsl:if>\r
159                                 </xsl:variable>\r
160                                 <xsl:attribute name="style">\r
161                                         <xsl:value-of select="concat($width,$height,$top2,$left2,$fontsize,$fontbold)"/>\r
162                                 </xsl:attribute>\r
163                                 <xsl:comment><![CDATA[[if lte IE 7]><table><tr><td><![endif]]]></xsl:comment>\r
164                                         <span>\r
165                                         <xsl:apply-templates/>\r
166                                         </span>\r
167                                 <xsl:comment><![CDATA[[if lte IE 7]></td></tr></table><![endif]]]></xsl:comment>\r
168                         </div>\r
169                 </xsl:for-each>         \r
170     </xsl:template>\r
171 \r
172 </xsl:stylesheet>