Last change
on this file since 33995 was 7296, checked in by vboxsync, 17 years ago |
Added libxslt-1.1.22 sources.
|
-
Property svn:eol-style
set to
native
-
Property svn:keywords
set to
Date Revision Author Id
|
File size:
1.4 KB
|
Line | |
---|
1 | #!/usr/bin/python -u
|
---|
2 | import sys
|
---|
3 | import libxml2
|
---|
4 | # Memory debug specific
|
---|
5 | libxml2.debugMemory(1)
|
---|
6 | import libxslt
|
---|
7 |
|
---|
8 |
|
---|
9 | styledoc = libxml2.parseDoc(
|
---|
10 | """<?xml version="1.0"?>
|
---|
11 | <xsl:stylesheet version="1.0"
|
---|
12 | xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
---|
13 | xmlns:str="http://exslt.org/strings"
|
---|
14 | exclude-result-prefixes="str">
|
---|
15 |
|
---|
16 | <xsl:template match="/">
|
---|
17 | <out>;
|
---|
18 | str:tokenize('2001-06-03T11:40:23', '-T:')
|
---|
19 | <xsl:copy-of select="str:tokenize('2001-06-03T11:40:23', '-T:')"/>;
|
---|
20 |
|
---|
21 | str:tokenize('date math str')
|
---|
22 | <xsl:copy-of select="str:tokenize('date math str')"/>;
|
---|
23 | </out>
|
---|
24 | </xsl:template>
|
---|
25 |
|
---|
26 | </xsl:stylesheet>
|
---|
27 | """)
|
---|
28 | style = libxslt.parseStylesheetDoc(styledoc)
|
---|
29 | doc = libxml2.parseDoc("<doc/>")
|
---|
30 | result = style.applyStylesheet(doc, None)
|
---|
31 | stringval = style.saveResultToString(result)
|
---|
32 | style.freeStylesheet()
|
---|
33 | doc.freeDoc()
|
---|
34 | result.freeDoc()
|
---|
35 |
|
---|
36 | expect="""<?xml version="1.0"?>
|
---|
37 | <out>;
|
---|
38 | str:tokenize('2001-06-03T11:40:23', '-T:')
|
---|
39 | <token>2001</token><token>06</token><token>03</token><token>11</token><token>40</token><token>23</token>;
|
---|
40 |
|
---|
41 | str:tokenize('date math str')
|
---|
42 | <token>date</token><token>math</token><token>str</token>;
|
---|
43 | </out>
|
---|
44 | """
|
---|
45 |
|
---|
46 | if stringval != expect:
|
---|
47 | print "Exslt processing failed"
|
---|
48 | sys.exit(255)
|
---|
49 |
|
---|
50 | # Memory debug specific
|
---|
51 | libxslt.cleanup()
|
---|
52 | if libxml2.debugMemory(1) == 0:
|
---|
53 | print "OK"
|
---|
54 | else:
|
---|
55 | print "Memory leak %d bytes" % (libxml2.debugMemory(1))
|
---|
56 | libxml2.dumpMemory()
|
---|
Note:
See
TracBrowser
for help on using the repository browser.