Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> xml i xslt z openoffice write jak dostać sie do odpowiedniej zawartości
adamec
post 5.06.2012, 09:16:11
Post #1





Grupa: Zarejestrowani
Postów: 30
Pomógł: 3
Dołączył: 18.04.2012
Skąd: Rybnik

Ostrzeżenie: (0%)
-----


Mam taki problem, nad którym już długo siedzę ale nie daje rady. Chcę chcę się dostać do zawartości znacznika <w:t> i ładnie go wyświetlić w tabeli.
Mam taki xml
  1. <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
  2. <?mso-application progid="Word.Document"?>
  3. <w:wordDocument xmlns:aml="http://schemas.microsoft.com/aml/2001/core" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml" xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint" xmlns:o="urn:schemas-microsoft-com:office:office" xml:space="preserve" w:embeddedObjPresent="no">
  4. <o:DocumentProperties>
  5. <o:Title/>
  6. <o:Subject/>
  7. <o:Keywords/>
  8. <o:Description/>
  9. <o:Category/>
  10. <o:Author>adam </o:Author>
  11. <o:LastAuthor>adam </o:LastAuthor>
  12. <o:Manager/>
  13. <o:Company/>
  14. <o:HyperlinkBase/>
  15. <o:Revision>1</o:Revision>
  16. <o:TotalTime>2</o:TotalTime>
  17. <o:LastPrinted/>
  18. <o:Created>2012-04-17T11:37:52.58Z</o:Created>
  19. <o:LastSaved>2012-04-17T11:40:01.87Z</o:LastSaved>
  20. <o:Pages>1</o:Pages>
  21. <o:Words>4</o:Words>
  22. <o:Characters>21</o:Characters>
  23. <o:Paragraphs>1</o:Paragraphs>
  24. </o:DocumentProperties>
  25. <o:CustomDocumentProperties>
  26. <o:Editor dt:dt="string">OpenOffice.org/3.2$Win32 OpenOffice.org_project/320m18$Build-9502</o:Editor>
  27. <o:Language dt:dt="string"/>
  28. </o:CustomDocumentProperties>
  29. <w:fonts>
  30. <w:defaultFonts w:ascii="" w:h-ansi="" w:fareast="" w:cs=""/>
  31. </w:fonts>
  32. <w:lists>
  33. <w:listDef w:listDefId="0">
  34. <w:lvl w:ilvl="0">
  35. <w:start w:val="1"/>
  36. <w:nfc w:val="255"/>
  37. <w:lvlText w:val="%1"/>
  38. <w:lvlJc w:val="left"/>
  39. <w:suff w:val="Nothing"/>
  40. </w:lvl>
  41. <w:lvl w:ilvl="1">
  42. <w:start w:val="1"/>
  43. <w:nfc w:val="255"/>
  44. <w:lvlText w:val="%2"/>
  45. <w:lvlJc w:val="left"/>
  46. <w:suff w:val="Nothing"/>
  47. </w:lvl>
  48. <w:lvl w:ilvl="2">
  49. <w:start w:val="1"/>
  50. <w:nfc w:val="255"/>
  51. <w:lvlText w:val="%3"/>
  52. <w:lvlJc w:val="left"/>
  53. <w:suff w:val="Nothing"/>
  54. </w:lvl>
  55. <w:lvl w:ilvl="3">
  56. <w:start w:val="1"/>
  57. <w:nfc w:val="255"/>
  58. <w:lvlText w:val="%4"/>
  59. <w:lvlJc w:val="left"/>
  60. <w:suff w:val="Nothing"/>
  61. </w:lvl>
  62. <w:lvl w:ilvl="4">
  63. <w:start w:val="1"/>
  64. <w:nfc w:val="255"/>
  65. <w:lvlText w:val="%5"/>
  66. <w:lvlJc w:val="left"/>
  67. <w:suff w:val="Nothing"/>
  68. </w:lvl>
  69. <w:lvl w:ilvl="5">
  70. <w:start w:val="1"/>
  71. <w:nfc w:val="255"/>
  72. <w:lvlText w:val="%6"/>
  73. <w:lvlJc w:val="left"/>
  74. <w:suff w:val="Nothing"/>
  75. </w:lvl>
  76. <w:lvl w:ilvl="6">
  77. <w:start w:val="1"/>
  78. <w:nfc w:val="255"/>
  79. <w:lvlText w:val="%7"/>
  80. <w:lvlJc w:val="left"/>
  81. <w:suff w:val="Nothing"/>
  82. </w:lvl>
  83. <w:lvl w:ilvl="7">
  84. <w:start w:val="1"/>
  85. <w:nfc w:val="255"/>
  86. <w:lvlText w:val="%8"/>
  87. <w:lvlJc w:val="left"/>
  88. <w:suff w:val="Nothing"/>
  89. </w:lvl>
  90. <w:lvl w:ilvl="8">
  91. <w:start w:val="1"/>
  92. <w:nfc w:val="255"/>
  93. <w:lvlText w:val="%9"/>
  94. <w:lvlJc w:val="left"/>
  95. <w:suff w:val="Nothing"/>
  96. </w:lvl>
  97. </w:listDef>
  98. <w:list w:ilfo="1">
  99. <w:ilst w:val="0"/>
  100. </w:list>
  101. </w:lists>
  102. <w:styles>
  103. <w:style w:styleId="default-paragraph-style" w:type="paragraph" w:default="on">
  104. <w:name w:val="default-paragraph-style"/>
  105. <w:pPr>
  106. <w:adjustRightInd w:val="off"/>
  107. <w:spacing/>
  108. <w:ind/>
  109. <w:widowControl w:val="off"/>
  110. <w:pBdr/>
  111. <w:ind/>
  112. </w:pPr>
  113. <w:rPr>
  114. <w:rFonts w:ascii="Times New Roman" w:h-ansi="Times New Roman" w:fareast="SimSun" w:cs="Mangal"/>
  115. <w:sz w:val="24"/>
  116. <w:lang w:val="pl-PL"/>
  117. </w:rPr>
  118. </w:style>
  119. <w:style w:styleId="default-table-style" w:type="table" w:default="on">
  120. <w:name w:val="default-table-style"/>
  121. <w:tblPr>
  122. <w:tblInd w:w="0" w:type="auto"/>
  123. </w:tblPr>
  124. </w:style>
  125. <w:style w:styleId="Standard" w:type="paragraph">
  126. <w:basedOn w:val="default-paragraph-style"/>
  127. <w:name w:val="Standard"/>
  128. </w:style>
  129. <w:style w:styleId="Header" w:type="paragraph">
  130. <w:basedOn w:val="Standard"/>
  131. <w:name w:val="Header"/>
  132. <w:next w:val="Text_20_body"/>
  133. <w:pPr>
  134. <w:adjustRightInd w:val="off"/>
  135. <w:spacing w:before="239.841" w:after="120.204"/>
  136. <w:ind/>
  137. <w:widowControl w:val="off"/>
  138. <w:pBdr/>
  139. <w:ind/>
  140. </w:pPr>
  141. <w:rPr>
  142. <w:rFonts w:ascii="Arial" w:h-ansi="Arial" w:fareast="SimSun" w:cs="Mangal"/>
  143. <w:sz w:val="28"/>
  144. </w:rPr>
  145. </w:style>
  146. <w:style w:styleId="Text_20_body" w:type="paragraph">
  147. <w:basedOn w:val="Standard"/>
  148. <w:name w:val="Text_20_body"/>
  149. <w:pPr>
  150. <w:adjustRightInd w:val="off"/>
  151. <w:spacing w:before="0" w:after="120.204"/>
  152. <w:ind/>
  153. <w:widowControl w:val="off"/>
  154. <w:pBdr/>
  155. <w:ind/>
  156. </w:pPr>
  157. </w:style>
  158. <w:style w:styleId="List" w:type="paragraph">
  159. <w:basedOn w:val="Text_20_body"/>
  160. <w:name w:val="List"/>
  161. <w:rPr>
  162. <w:rFonts w:cs="Mangal1"/>
  163. </w:rPr>
  164. </w:style>
  165. <w:style w:styleId="Caption" w:type="paragraph">
  166. <w:basedOn w:val="Standard"/>
  167. <w:name w:val="Caption"/>
  168. <w:pPr>
  169. <w:adjustRightInd w:val="off"/>
  170. <w:spacing w:before="120.204" w:after="120.204"/>
  171. <w:ind/>
  172. <w:widowControl w:val="off"/>
  173. <w:supressLineNumbers/>
  174. <w:pBdr/>
  175. <w:ind/>
  176. </w:pPr>
  177. <w:rPr>
  178. <w:rFonts w:cs="Mangal1"/>
  179. <w:sz w:val="24"/>
  180. <w:i/>
  181. </w:rPr>
  182. </w:style>
  183. <w:style w:styleId="Index" w:type="paragraph">
  184. <w:basedOn w:val="Standard"/>
  185. <w:name w:val="Index"/>
  186. <w:pPr>
  187. <w:adjustRightInd w:val="off"/>
  188. <w:spacing/>
  189. <w:ind/>
  190. <w:widowControl w:val="off"/>
  191. <w:supressLineNumbers/>
  192. <w:pBdr/>
  193. <w:ind/>
  194. </w:pPr>
  195. <w:rPr>
  196. <w:rFonts w:cs="Mangal1"/>
  197. </w:rPr>
  198. </w:style>
  199. <w:style w:type="character" w:styleId="Hyperlink">
  200. <w:name w:val="Hyperlink"/>
  201. <w:rsid w:val="006A55B0"/>
  202. <w:rPr>
  203. <w:color w:val="000080"/>
  204. <w:u w:val="single"/>
  205. </w:rPr>
  206. </w:style>
  207. <w:style w:type="character" w:styleId="FollowedHyperlink">
  208. <w:name w:val="FollowedHyperlink"/>
  209. <w:rsid w:val="006A55B0"/>
  210. <w:rPr>
  211. <w:color w:val="800000"/>
  212. <w:u w:val="single"/>
  213. </w:rPr>
  214. </w:style>
  215. <w:style w:type="character" w:styleId="CommentReference">
  216. <w:name w:val="annotation reference"/>
  217. <w:basedOn w:val="DefaultParagraphFont"/>
  218. <w:semiHidden/>
  219. <w:rsid w:val="007770B7"/>
  220. <w:rPr>
  221. <w:sz w:val="16"/>
  222. <w:sz-cs w:val="16"/>
  223. </w:rPr>
  224. </w:style>
  225. <w:style w:type="paragraph" w:styleId="CommentText">
  226.  
  227. </w:style>
  228. <w:style w:type="paragraph" w:styleId="CommentSubject">
  229. <w:name w:val="annotation subject"/>
  230. <w:basedOn w:val="CommentText"/>
  231. <w:next w:val="CommentText"/>
  232. <w:semiHidden/>
  233. <w:rsid w:val="007770B7"/>
  234. <w:pPr>
  235. <w:pStyle w:val="CommentSubject"/>
  236. </w:pPr>
  237. <w:rPr>
  238. <w:b/>
  239. <w:b-cs/>
  240. </w:rPr>
  241. </w:style>
  242. </w:styles>
  243. <w:docPr>
  244. <w:displayBackgroundShape/>
  245. <w:view w:val="print"/>
  246. <w:zoom w:percent=""/>
  247. <w:defaultTabStop w:val="709.317"/>
  248. <w:docVars/>
  249. </w:docPr>
  250. <w:body>
  251. <w:p>
  252. <w:pPr>
  253. <w:pStyle w:val="Standard"/>
  254. </w:pPr>
  255. <w:r>
  256. <w:t>To jest tekst testowy</w:t>
  257. </w:r>
  258. </w:p>
  259. <w:sectPr>
  260. <w:type w:val="next-page"/>
  261. <w:pgSz w:w="11907.5672" w:h="16839.9003" w:orient="portrait"/>
  262. <w:pgMar w:top="1134" w:bottom="1134" w:left="1134" w:gutter="0" w:right="1134"/>
  263. <w:pgBorders w:offset-from="text"/>
  264. </w:sectPr>
  265. </w:body>
  266. </w:wordDocument>
  267.  



i taki xslt

  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:aml="http://schemas.microsoft.com/aml/2001/core" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml" xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint" xmlns:o="urn:schemas-microsoft-com:office:office">
  6. <xsl:output method="html" encoding="UTF-8"/>
  7. <xsl:template match="/">
  8. <html>
  9. <body>
  10. <xsl:apply-templates/>
  11. </body>
  12. </html>
  13.  
  14. </xsl:template>
  15.  
  16.  
  17. <xsl:template match="o:DocumentProperties">
  18. <table border="1">
  19. <tr>
  20. <td><b>Imie</b></td><td><b>Nazwisko</b></td><td><b>Data</b></td>
  21. <tr>
  22. <td><xsl:value-of select="o:Author"/></td>
  23. <td><xsl:value-of select="o:LastAuthor"/></td>
  24. <td><xsl:value-of select="o:LastSaved"/></td>
  25.  
  26. </tr>
  27. </tr>
  28. </table>
  29.  
  30. </xsl:template >
  31.  
  32. <xsl:template match="w:sectPr">
  33. <xsl:value-of select="o:t"/>
  34. </xsl:template>
  35. </xsl:stylesheet>


otrzymuję coś takiego

  1. <body>
  2. <table border="1">
  3. <tr>
  4. <td><b>Imie</b></td>
  5. <td><b>Nazwisko</b></td>
  6. <td><b>Data</b></td>
  7. <tr>
  8. <td>adam </td>
  9. <td>adam </td>
  10. <td>2012-04-17T11:40:01.87Z</td>
  11. </tr>
  12. </tr>
  13. </table>OpenOffice.org/3.2$Win32 OpenOffice.org_project/320m18$Build-9502To jest tekst testowy</body>
  14. </html>

ta linijka mi coś miesz jak poprawnie zmienić xslt aby : zawatrość była tylko "To jest tekst testowy"


--------------------
Jeżeli uda mi się pomóc Tobie to jestem usatysfakcjonowany . Wtedy Ty kliknij na POMÓGŁ
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Wersja Lo-Fi Aktualny czas: 25.04.2024 - 01:52