By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,364 Members | 1,272 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,364 IT Pros & Developers. It's quick & easy.

very first transform (xalon)

P: n/a
Just for posterity:
[thufir@localhost w3school]$ pwd
/home/thufir/xalon/w3school
[thufir@localhost w3school]$ whoami
thufir
[thufir@localhost w3school]$ ll
total 24
-rw-rw-r-- 1 thufir thufir 239 Feb 19 09:16 foo.xml
-rw-rw-r-- 1 thufir thufir 546 Feb 19 09:18 foo.xsl
-rw-rw-r-- 1 thufir thufir 73 Feb 19 09:23 notes.txt
[thufir@localhost w3school]$ cat notes.txt
adapted from:

<http://www.w3schools.com/xsl/xsl_transformation.asp>
[thufir@localhost w3school]$ java -cp
/usr/share/java/xalan-j2.jar:/usr/share/java/xalan-j2-serializer.jar
org.apache.xalan.xslt.Process -IN foo.xml -XSL foo.xsl -OUT foo.html
[thufir@localhost w3school]$ ll
total 32
-rw-rw-r-- 1 thufir thufir 224 Feb 19 09:24 foo.html
-rw-rw-r-- 1 thufir thufir 239 Feb 19 09:16 foo.xml
-rw-rw-r-- 1 thufir thufir 546 Feb 19 09:18 foo.xsl
-rw-rw-r-- 1 thufir thufir 73 Feb 19 09:23 notes.txt
[thufir@localhost w3school]$ cat foo.xml -n
1 <?xml version="1.0" encoding="ISO-8859-1"?>
2 <catalog>
3 <cd>
4 <title>Empire Burlesque</title>
5 <artist>Bob Dylan</artist>
6 <country>USA</country>
7 <company>Columbia</company>
8 <price>10.90</price>
9 <year>1985</year>
10 </cd>
11 </catalog>
[thufir@localhost w3school]$ cat foo.xsl -n
1 <?xml version="1.0" encoding="ISO-8859-1"?>
2
3 <xsl:stylesheet version="1.0"
4 xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
5
6 <xsl:template match="/">
7 <html>
8 <body>
9 <h2>My CD Collection</h2>
10 <table border="1">
11 <tr bgcolor="#9acd32">
12 <th align="left">Title</th>
13 <th align="left">Artist</th>
14 </tr>
15 <xsl:for-each select="catalog/cd">
16 <tr>
17 <td><xsl:value-of
select="title"/></td>
18 <td><xsl:value-of
select="artist"/></td>
19 </tr>
20 </xsl:for-each>
21 </table>
22 </body>
23 </html>
24 </xsl:template>
25
26 </xsl:stylesheet>
[thufir@localhost w3school]$ cat foo.html -n
1 <html>
2 <body>
3 <h2>My CD Collection</h2>
4 <table border="1">
5 <tr bgcolor="#9acd32">
6 <th align="left">Title</th><th align="left">Artist</th>
7 </tr>
8 <tr>
9 <td>Empire Burlesque</td><td>Bob Dylan</td>
10 </tr>
11 </table>
12 </body>
13 </html>
[thufir@localhost w3school]$ date
Sun Feb 19 09:25:04 EST 2006
[thufir@localhost w3school]$

-Thufir

Feb 19 '06 #1
Share this Question
Share on Google+
4 Replies


P: n/a
A better example:

[thufir@localhost wikipedia]$
[thufir@localhost wikipedia]$
[thufir@localhost wikipedia]$ whoami
thufir
[thufir@localhost wikipedia]$ pwd
/home/thufir/xalon/wikipedia
[thufir@localhost wikipedia]$ ll
total 40
-rw-rw-r-- 1 thufir thufir 572 Feb 19 10:20 links.xml
-rw-rw-r-- 1 thufir thufir 2222 Feb 19 10:19 links.xsl
-rw-rw-r-- 1 thufir thufir 203 Feb 19 10:17 persons2.xml
-rw-rw-r-- 1 thufir thufir 230 Feb 19 10:15 persons.xml
-rw-rw-r-- 1 thufir thufir 505 Feb 19 10:15 persons.xsl
[thufir@localhost wikipedia]$ java -cp
/usr/share/java/xalan-j2.jar:/usr/share/java/xalan-j2-serializer.jar
org.apache.xalan.xslt.Process -IN links.xml -XSL links.xsl -OUT
links.xhtml
[thufir@localhost wikipedia]$ ll
total 48
-rw-rw-r-- 1 thufir thufir 1754 Feb 19 10:39 links.xhtml
-rw-rw-r-- 1 thufir thufir 572 Feb 19 10:20 links.xml
-rw-rw-r-- 1 thufir thufir 2222 Feb 19 10:19 links.xsl
-rw-rw-r-- 1 thufir thufir 203 Feb 19 10:17 persons2.xml
-rw-rw-r-- 1 thufir thufir 230 Feb 19 10:15 persons.xml
-rw-rw-r-- 1 thufir thufir 505 Feb 19 10:15 persons.xsl
[thufir@localhost wikipedia]$ cat links.xml -n
1 <?xml version="1.0" encoding="UTF-8"?>
2
3 <domains>
4 <sun.com ownedBy="Sun Microsystems Inc.">
5 <host>
6 www
7 <use>World Wide Web site</use>
8 </host>
9 <host>
10 java
11 <use>Java info</use>
12 </host>
13 </sun.com>
14
15 <w3.org ownedBy="The World Wide Web Consortium">
16 <host>
17 www
18 <use>World Wide Web site</use>
19 </host>
20 <host>
21 validator
22 <use>web developers who want to get it right</use>
23 </host>
24 </w3.org>
25 </domains>
26
[thufir@localhost wikipedia]$ cat links.xsl -n
1 <?xml version="1.0" encoding="UTF-8" ?>
2
3 <xsl:stylesheet version="1.0"
4 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
5 xmlns="http://www.w3.org/1999/xhtml">
6 <xsl:output method="xml" indent="yes"
7 doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
8
doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"/>
9
10 <!--XHTML document outline-->
11 <xsl:template match="/">
12 <html xmlns="http://www.w3.org/1999/xhtml"
xml:lang="en" lang="en">
13 <head>
14 <meta http-equiv="Content-Type"
content="text/html; charset=UTF-8"
15 />
16 <title>test1</title>
17 <style type="text/css">
18 h1 { padding: 10px; padding-width:
100%;
19 background-color: silver }
20 td, th { width: 40%; border: 1px solid
silver; padding:
21 10px }
22 td:first-child, th:first-child { width:
20% }
23 table { width: 650px }
24 </style>
25 </head>
26 <body>
27 <xsl:apply-templates/>
28 </body>
29 </html>
30 </xsl:template>
31
32 <!--Table headers and outline-->
33 <xsl:template match="domains/*">
34 <h1><xsl:value-of select="@ownedBy"/></h1>
35 <p>The following host names are currently in use at
36 <strong><xsl:value-of
select="local-name(.)"/></strong>
37 </p>
38 <table>
39 <tr><th>Host name</th><th>URL</th><th>Used
by</th></tr>
40 <xsl:apply-templates/>
41 </table>
42 </xsl:template>
43
44 <!--Table row and first two columns-->
45 <xsl:template match="host">
46 <!--Create variable for 'url', as it's used twice-->
47 <xsl:variable name="url" select=
48 "normalize-space(concat('http://',
normalize-space(node()), '.',
49 local-name(..)))"/>
50 <tr>
51 <td><xsl:value-of select="node()"/></td>
52 <td><a href="{$url}"><xsl:value-of
select="$url"/></a></td>
53 <xsl:apply-templates select="use"/>
54 </tr>
55 </xsl:template>
56
57 <!--'Used by' column-->
58 <xsl:template match="use">
59 <td><xsl:value-of select="."/></td>
60 </xsl:template>
61
62 </xsl:stylesheet>
[thufir@localhost wikipedia]$ cat links.xhtml -n
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3 <html xmlns="http://www.w3.org/1999/xhtml" lang="en"
xml:lang="en">
4 <head>
5 <meta content="text/html; charset=UTF-8"
http-equiv="Content-Type" />
6 <title>test1</title>
7 <style type="text/css">
8 h1 { padding: 10px; padding-width:
100%;
9 background-color: silver }
10 td, th { width: 40%; border: 1px solid
silver; padding:
11 10px }
12 td:first-child, th:first-child { width:
20% }
13 table { width: 650px }
14 </style>
15 </head>
16 <body>
17 <h1>Sun Microsystems Inc.</h1>
18 <p>The following host names are currently in use at
19 <strong>sun.com</strong>
20 </p>
21 <table>
22 <tr>
23 <th>Host name</th>
24 <th>URL</th>
25 <th>Used by</th>
26 </tr>
27 <tr>
28 <td>
29 www
30 </td>
31 <td>
32 <a href="http://www.sun.com">http://www.sun.com</a>
33 </td>
34 <td>World Wide Web site</td>
35 </tr>
36 <tr>
37 <td>
38 java
39 </td>
40 <td>
41 <a href="http://java.sun.com">http://java.sun.com</a>
42 </td>
43 <td>Java info</td>
44 </tr>
45 </table>
46
47 <h1>The World Wide Web Consortium</h1>
48 <p>The following host names are currently in use at
49 <strong>w3.org</strong>
50 </p>
51 <table>
52 <tr>
53 <th>Host name</th>
54 <th>URL</th>
55 <th>Used by</th>
56 </tr>
57 <tr>
58 <td>
59 www
60 </td>
61 <td>
62 <a href="http://www.w3.org">http://www.w3.org</a>
63 </td>
64 <td>World Wide Web site</td>
65 </tr>
66 <tr>
67 <td>
68 validator
69 </td>
70 <td>
71 <a href="http://validator.w3.org">http://validator.w3.org</a>
72 </td>
73 <td>web developers who want to get it right</td>
74 </tr>
75 </table>
76 </body>
77 </html>
[thufir@localhost wikipedia]$ date
Sun Feb 19 10:39:38 EST 2006
[thufir@localhost wikipedia]$
[thufir@localhost wikipedia]$


-Thufir

Feb 19 '06 #2

P: n/a
a better example:

[thufir@localhost wikipedia]$
[thufir@localhost wikipedia]$ pwd
/home/thufir/xalon/wikipedia
[thufir@localhost wikipedia]$ whoami
thufir
[thufir@localhost wikipedia]$ ll
total 40
-rw-rw-r-- 1 thufir thufir 572 Feb 19 10:20 links.xml
-rw-rw-r-- 1 thufir thufir 2222 Feb 19 10:19 links.xsl
-rw-rw-r-- 1 thufir thufir 203 Feb 19 10:17 persons2.xml
-rw-rw-r-- 1 thufir thufir 230 Feb 19 10:15 persons.xml
-rw-rw-r-- 1 thufir thufir 505 Feb 19 10:15 persons.xsl
[thufir@localhost wikipedia]$ java -cp
/usr/share/java/xalan-j2.jar:/usr/share/java/xalan-j2-serializer.jar
org.apache.xalan.xslt.Process -IN links.xml -XSL links.xsl -OUT
links.xhtml
[thufir@localhost wikipedia]$ cat links.xml -n
1 <?xml version="1.0" encoding="UTF-8"?>
2
3 <domains>
4 <sun.com ownedBy="Sun Microsystems Inc.">
5 <host>
6 www
7 <use>World Wide Web site</use>
8 </host>
9 <host>
10 java
11 <use>Java info</use>
12 </host>
13 </sun.com>
14
15 <w3.org ownedBy="The World Wide Web Consortium">
16 <host>
17 www
18 <use>World Wide Web site</use>
19 </host>
20 <host>
21 validator
22 <use>web developers who want to get it right</use>
23 </host>
24 </w3.org>
25 </domains>
26
[thufir@localhost wikipedia]$ cat links.xsl -n
1 <?xml version="1.0" encoding="UTF-8" ?>
2
3 <xsl:stylesheet version="1.0"
4 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
5 xmlns="http://www.w3.org/1999/xhtml">
6 <xsl:output method="xml" indent="yes"
7 doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
8
doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"/>
9
10 <!--XHTML document outline-->
11 <xsl:template match="/">
12 <html xmlns="http://www.w3.org/1999/xhtml"
xml:lang="en" lang="en">
13 <head>
14 <meta http-equiv="Content-Type"
content="text/html; charset=UTF-8"
15 />
16 <title>test1</title>
17 <style type="text/css">
18 h1 { padding: 10px; padding-width:
100%;
19 background-color: silver }
20 td, th { width: 40%; border: 1px solid
silver; padding:
21 10px }
22 td:first-child, th:first-child { width:
20% }
23 table { width: 650px }
24 </style>
25 </head>
26 <body>
27 <xsl:apply-templates/>
28 </body>
29 </html>
30 </xsl:template>
31
32 <!--Table headers and outline-->
33 <xsl:template match="domains/*">
34 <h1><xsl:value-of select="@ownedBy"/></h1>
35 <p>The following host names are currently in use at
36 <strong><xsl:value-of
select="local-name(.)"/></strong>
37 </p>
38 <table>
39 <tr><th>Host name</th><th>URL</th><th>Used
by</th></tr>
40 <xsl:apply-templates/>
41 </table>
42 </xsl:template>
43
44 <!--Table row and first two columns-->
45 <xsl:template match="host">
46 <!--Create variable for 'url', as it's used twice-->
47 <xsl:variable name="url" select=
48 "normalize-space(concat('http://',
normalize-space(node()), '.',
49 local-name(..)))"/>
50 <tr>
51 <td><xsl:value-of select="node()"/></td>
52 <td><a href="{$url}"><xsl:value-of
select="$url"/></a></td>
53 <xsl:apply-templates select="use"/>
54 </tr>
55 </xsl:template>
56
57 <!--'Used by' column-->
58 <xsl:template match="use">
59 <td><xsl:value-of select="."/></td>
60 </xsl:template>
61
62 </xsl:stylesheet>
[thufir@localhost wikipedia]$ cat links.xhtml -n
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3 <html xmlns="http://www.w3.org/1999/xhtml" lang="en"
xml:lang="en">
4 <head>
5 <meta content="text/html; charset=UTF-8"
http-equiv="Content-Type" />
6 <title>test1</title>
7 <style type="text/css">
8 h1 { padding: 10px; padding-width:
100%;
9 background-color: silver }
10 td, th { width: 40%; border: 1px solid
silver; padding:
11 10px }
12 td:first-child, th:first-child { width:
20% }
13 table { width: 650px }
14 </style>
15 </head>
16 <body>
17 <h1>Sun Microsystems Inc.</h1>
18 <p>The following host names are currently in use at
19 <strong>sun.com</strong>
20 </p>
21 <table>
22 <tr>
23 <th>Host name</th>
24 <th>URL</th>
25 <th>Used by</th>
26 </tr>
27 <tr>
28 <td>
29 www
30 </td>
31 <td>
32 <a href="http://www.sun.com">http://www.sun.com</a>
33 </td>
34 <td>World Wide Web site</td>
35 </tr>
36 <tr>
37 <td>
38 java
39 </td>
40 <td>
41 <a href="http://java.sun.com">http://java.sun.com</a>
42 </td>
43 <td>Java info</td>
44 </tr>
45 </table>
46
47 <h1>The World Wide Web Consortium</h1>
48 <p>The following host names are currently in use at
49 <strong>w3.org</strong>
50 </p>
51 <table>
52 <tr>
53 <th>Host name</th>
54 <th>URL</th>
55 <th>Used by</th>
56 </tr>
57 <tr>
58 <td>
59 www
60 </td>
61 <td>
62 <a href="http://www.w3.org">http://www.w3.org</a>
63 </td>
64 <td>World Wide Web site</td>
65 </tr>
66 <tr>
67 <td>
68 validator
69 </td>
70 <td>
71 <a href="http://validator.w3.org">http://validator.w3.org</a>
72 </td>
73 <td>web developers who want to get it right</td>
74 </tr>
75 </table>
76 </body>
77 </html>
[thufir@localhost wikipedia]$ date
Sun Feb 19 10:23:22 EST 2006
[thufir@localhost wikipedia]$

-Thufir

Feb 19 '06 #3

P: n/a
And it all goes to shite..

[thufir@localhost foo]$
[thufir@localhost foo]$
[thufir@localhost foo]$
[thufir@localhost foo]$ whoami
thufir
[thufir@localhost foo]$ pwd
/home/thufir/xalon/foo
[thufir@localhost foo]$ ll
total 28
-rw-rw-r-- 1 thufir thufir 6787 Feb 18 06:59 foo.ods
-rw-rw-r-- 1 thufir thufir 3194 Feb 18 07:05 foo.xhtml
-rw-rw-r-- 1 thufir thufir 423 Feb 18 07:07 foo.xsl
[thufir@localhost foo]$ java -cp
/usr/share/java/xalan-j2.jar:/usr/share/java/xalan-j2-serializer.jar
org.apache.xalan.xslt.Process -IN foo.xhtml -XSL foo.xsl -OUT foo.txt
[thufir@localhost foo]$ ll
total 32
-rw-rw-r-- 1 thufir thufir 6787 Feb 18 06:59 foo.ods
-rw-rw-r-- 1 thufir thufir 0 Feb 19 14:39 foo.txt
-rw-rw-r-- 1 thufir thufir 3194 Feb 18 07:05 foo.xhtml
-rw-rw-r-- 1 thufir thufir 423 Feb 18 07:07 foo.xsl
[thufir@localhost foo]$ cat foo.txt -n
[thufir@localhost foo]$ cat foo.xsl -n
1 <xsl:stylesheet version="1.0"
2 xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
3
4 <xsl:output method="text" version="1.0" encoding="UTF-8" />
5
6 <xsl:template match="/">
7 <xsl:apply-templates select="//a[@href]"/>
8 </xsl:template>
9
10 <xsl:template match="a[@href]">
11 <xsl:value-of select="."/>
12 <xsl:text> </xsl:text>
13 <xsl:value-of select="@href"/>
14 <xsl:text>
15 </xsl:text>
16 </xsl:template>
17
18 </xsl:stylesheet>
[thufir@localhost foo]$ cat foo.xhtml -n
1 <?xml version="1.0" encoding="UTF-8"?><!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
2 <html xmlns="http://www.w3.org/1999/xhtml"><head><meta
http-equiv="content-type" content="text/html; charset=utf-8" /><title
/><meta name="generator" content="StarOffice/OpenOffice.org XSLT
(http://xml.openoffice.org/sx2ml)" /><meta name="created"
content="2006-02-18T06:45:34" /><meta name="changed"
content="2006-02-18T06:59:44" /><base href="." /><style
type="text/css">
3 @page { }
4 table { border-collapse:collapse; border-spacing:0;
empty-cells:show }
5 td, th { vertical-align:top; }
6 h1, h2, h3, h4, h5, h6 { clear:both }
7 ol, ul { padding:0; }
8 * { margin:0; }
9 *.ta1 { }
10 *.ce1 { font-family:'Nimbus Roman No9 L';
text-align:right ! important; font-size:10pt; font-style:normal;
text-shadow:none; font-weight:normal; }
11 *.ce2 { font-family:'Bitstream Vera Sans';
text-align:right ! important; }
12 *.ce3 { font-family:'Nimbus Roman No9 L';
font-size:10pt; font-style:normal; text-shadow:none;
font-weight:normal; }
13 *.Default { font-family:'Bitstream Vera Sans'; }
14 *.Heading { font-family:'Bitstream Vera Sans';
text-align:center ! important; font-size:16pt; font-style:italic;
font-weight:bold; }
15 *.Heading1 { font-family:'Bitstream Vera Sans';
text-align:center ! important; font-size:16pt; font-style:italic;
font-weight:bold; }
16 *.Result { font-family:'Bitstream Vera Sans';
font-style:italic; font-weight:bold; text-decoration:underline; }
17 *.Result2 { font-family:'Bitstream Vera Sans';
font-style:italic; font-weight:bold; text-decoration:underline; }
18 *.co1 { width:0.8925in; }
19 *.ro1 { height:0.4146in; }
20 *.ro2 { height:0.2173in; }
21 *.ro3 { height:0.1681in; }
22 </style></head><body dir="ltr"><table border="0"
cellspacing="0" cellpadding="0" class="ta1"><colgroup><col width="99"
/><col width="99" /></colgroup><tr class="ro1"><td
style="text-align:right; width:0.8925in; " class="ce1"><p>1
</p></td><td style="text-align:left;width:0.8925in; " class="ce3"><p><a
href="http://www.yahoo.com/">yahoo</a> </p></td></tr><tr
class="ro2"><td style="text-align:right; width:0.8925in; "
class="ce1"><p>2 </p></td><td style="text-align:left;width:0.8925in; "
class="ce3"><p><a
href="http://www.google.com/">google</a></p></td></tr><tr
class="ro1"><td style="text-align:right; width:0.8925in; "
class="ce1"><p>3 </p></td><td style="text-align:left;width:0.8925in; "
class="ce3"><p><a href="http://www.msn.com/">MSN</a> </p></td></tr><tr
class="ro3"><td style="text-align:left;width:0.8925in; " class="ce2"
/><td style="text-align:left;width:0.8925in; " class="Default"
/></tr><tr class="ro3"><td style="text-align:left;width:0.8925in; "
class="ce2" /><td style="text-align:left;width:0.8925in; "
class="Default" /></tr></table><table border="0" cellspacing="0"
cellpadding="0" class="ta1"><colgroup><col width="99" /></colgroup><tr
class="ro3"><td style="text-align:left;width:0.8925in; "
class="Default" /></tr></table><table border="0" cellspacing="0"
cellpadding="0" class="ta1"><colgroup><col width="99" /></colgroup><tr
class="ro3"><td style="text-align:left;width:0.8925in; "
class="Default" /></tr></table></body></html>
[thufir@localhost foo]$
[thufir@localhost foo]$ date
Sun Feb 19 14:39:57 EST 2006
[thufir@localhost foo]$
[thufir@localhost foo]$
[thufir@localhost foo]$
[thufir@localhost foo]$
-Thufir

Feb 19 '06 #4

P: n/a
hawat.thu...@gmail.com wrote:
And it all goes to shite..

...

I'm not sure that the following is totally kosher, or even has
application, but here it is:

[thufir@localhost foo]$
[thufir@localhost foo]$ ll
total 28
-rw-rw-r-- 1 thufir thufir 6787 Feb 18 06:59 foo.ods
-rw-rw-r-- 1 thufir thufir 3194 Feb 18 07:05 foo.xhtml
-rw-rw-r-- 1 thufir thufir 423 Feb 18 07:07 foo.xsl
[thufir@localhost foo]$ cp foo.xhtml foo.xhtml.xml
[thufir@localhost foo]$ cp foo.xsl foo.xsl.xml
[thufir@localhost foo]$ relaxer -verbose -xsd foo.xhtml.xml
Copyright(c) 2000-2003 ASAMI,Tomoharu. All rights reserved.
Relaxer Version 1.0rc2 (20030605) by as***@relaxer.org
Source file : file:/home/thufir/xalon/foo/foo.xhtml.xml
artifact = foo.xhtml.xsd
[thufir@localhost foo]$ relaxer -verbose -xsd foo.xsl.xml
Copyright(c) 2000-2003 ASAMI,Tomoharu. All rights reserved.
Relaxer Version 1.0rc2 (20030605) by as***@relaxer.org
Source file : file:/home/thufir/xalon/foo/foo.xsl.xml
artifact = foo.xsl.xsd
[thufir@localhost foo]$ cat foo.xsl.xsd -n
1 <?xml version="1.0" encoding="UTF-8" ?>
2 <xsd:schema xmlns="http://www.w3.org/1999/XSL/Transform"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
3 <xsd:element name="stylesheet" type="stylesheet"/>
4 <xsd:complexType name="stylesheet">
5 <xsd:sequence>
6 <xsd:element name="output" type="output"/>
7 <xsd:element maxOccurs="unbounded" minOccurs="1"
name="template" type="template"/>
8 </xsd:sequence>
9 <xsd:attribute name="version" type="xsd:float"/>
10 <xsd:attribute name="xsl" type="xsd:token"/>
11 </xsd:complexType>
12 <xsd:complexType name="output">
13 <xsd:sequence/>
14 <xsd:attribute name="encoding" type="xsd:token"/>
15 <xsd:attribute name="method" type="xsd:token"/>
16 <xsd:attribute name="version" type="xsd:float"/>
17 </xsd:complexType>
18 <xsd:complexType name="template">
19 <xsd:sequence>
20 <xsd:choice>
21 <xsd:group ref="sequence1"/>
22 <xsd:element name="apply-templates"
type="apply-templates"/>
23 </xsd:choice>
24 </xsd:sequence>
25 <xsd:attribute name="match" type="xsd:token"/>
26 </xsd:complexType>
27 <xsd:complexType name="value-of">
28 <xsd:sequence/>
29 <xsd:attribute name="select" type="xsd:token"/>
30 </xsd:complexType>
31 <xsd:complexType name="apply-templates">
32 <xsd:sequence/>
33 <xsd:attribute name="select" type="xsd:token"/>
34 </xsd:complexType>
35 <xsd:group name="sequence1">
36 <xsd:sequence>
37 <xsd:element name="value-of" type="value-of"/>
38 <xsd:element name="text" type="xsd:emptyString"/>
39 <xsd:element name="value-of" type="value-of"/>
40 <xsd:element name="text" type="xsd:emptyString"/>
41 </xsd:sequence>
42 </xsd:group>
43 </xsd:schema>
[thufir@localhost foo]$ cat foo.xhtml.xsd -n
1 <?xml version="1.0" encoding="UTF-8" ?>
2 <xsd:schema xmlns="http://www.w3.org/1999/xhtml"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
3 <xsd:element name="html" type="html"/>
4 <xsd:complexType name="html">
5 <xsd:sequence>
6 <xsd:element name="head" type="head"/>
7 <xsd:element name="body" type="body"/>
8 </xsd:sequence>
9 <xsd:attribute name="xmlns" type="xsd:token"/>
10 </xsd:complexType>
11 <xsd:complexType name="head">
12 <xsd:sequence>
13 <xsd:element name="meta" type="meta"/>
14 <xsd:element name="title" type="xsd:emptyString"/>
15 <xsd:element maxOccurs="unbounded" minOccurs="1"
name="meta" type="meta"/>
16 <xsd:element name="base" type="base"/>
17 <xsd:element name="style" type="style"/>
18 </xsd:sequence>
19 </xsd:complexType>
20 <xsd:complexType name="meta">
21 <xsd:sequence/>
22 <xsd:attribute name="content" type="xsd:token"/>
23 <xsd:attribute name="http-equiv" type="xsd:token"/>
24 <xsd:attribute name="name" type="xsd:token"/>
25 </xsd:complexType>
26 <xsd:complexType name="base">
27 <xsd:sequence/>
28 <xsd:attribute name="href" type="xsd:token"/>
29 </xsd:complexType>
30 <xsd:complexType name="style">
31 <xsd:simpleContent>
32 <xsd:extension base="xsd:string">
33 <xsd:attribute name="type" type="xsd:token"/>
34 <xsd:attribute name="space" type="xsd:token"/>
35 </xsd:extension>
36 </xsd:simpleContent>
37 </xsd:complexType>
38 <xsd:complexType name="body">
39 <xsd:sequence>
40 <xsd:element maxOccurs="unbounded" minOccurs="1"
name="table" type="table"/>
41 </xsd:sequence>
42 <xsd:attribute name="dir" type="xsd:token"/>
43 </xsd:complexType>
44 <xsd:complexType name="table">
45 <xsd:sequence>
46 <xsd:element name="colgroup" type="colgroup"/>
47 <xsd:element maxOccurs="unbounded" minOccurs="1"
name="tr" type="tr"/>
48 </xsd:sequence>
49 <xsd:attribute name="border" type="xsd:int"/>
50 <xsd:attribute name="cellpadding" type="xsd:int"/>
51 <xsd:attribute name="cellspacing" type="xsd:int"/>
52 <xsd:attribute name="class" type="xsd:token"/>
53 </xsd:complexType>
54 <xsd:complexType name="colgroup">
55 <xsd:sequence>
56 <xsd:element maxOccurs="unbounded" minOccurs="1"
name="col" type="col"/>
57 </xsd:sequence>
58 <xsd:attribute name="span" type="xsd:int"/>
59 </xsd:complexType>
60 <xsd:complexType name="col">
61 <xsd:sequence/>
62 <xsd:attribute name="span" type="xsd:int"/>
63 <xsd:attribute name="width" type="xsd:int"/>
64 </xsd:complexType>
65 <xsd:complexType name="tr">
66 <xsd:sequence>
67 <xsd:element maxOccurs="unbounded" minOccurs="1"
name="td" type="td"/>
68 </xsd:sequence>
69 <xsd:attribute name="class" type="xsd:token"/>
70 </xsd:complexType>
71 <xsd:complexType name="td">
72 <xsd:sequence>
73 <xsd:element name="p" type="p"/>
74 </xsd:sequence>
75 <xsd:attribute name="class" type="xsd:token"/>
76 <xsd:attribute name="colspan" type="xsd:int"/>
77 <xsd:attribute name="rowspan" type="xsd:int"/>
78 <xsd:attribute name="style" type="xsd:normalizedString"/>
79 </xsd:complexType>
80 <xsd:complexType name="p">
81 <xsd:sequence>
82 <xsd:element name="a" type="a"/>
83 </xsd:sequence>
84 </xsd:complexType>
85 <xsd:complexType name="a">
86 <xsd:simpleContent>
87 <xsd:extension base="xsd:token">
88 <xsd:attribute name="href" type="xsd:token"/>
89 <xsd:attribute name="shape" type="xsd:token"/>
90 </xsd:extension>
91 </xsd:simpleContent>
92 </xsd:complexType>
93 </xsd:schema>
[thufir@localhost foo]$ date
Sun Feb 19 14:50:18 EST 2006
[thufir@localhost foo]$

-Thufir

Feb 19 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.