Changeset 184
- Timestamp:
- 02/01/07 16:07:12 (1 year ago)
- Files:
-
- trunk/experiments/general/xsl/copy.xsl (added)
- trunk/experiments/general/xsl/parts.xml (added)
- trunk/experiments/general/xsl/stub.xsl (added)
- trunk/experiments/general/xsl/test.xml (modified) (1 diff)
- trunk/experiments/general/xsl/test.xsl (modified) (2 diffs)
- trunk/experiments/general/xsl/transform.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/experiments/general/xsl/test.xml
r183 r184 1 1 <?xml version="1.0" encoding="iso-8859-1"?> 2 <collection> 3 <cd> 4 <title>Wizards of the Sonic</title> 5 <artist>Westbam</artist> 6 <year>1994</year> 7 </cd> 8 <cd> 9 <title>Schöneberg</title> 10 <artist>Marmion</artist> 11 <year>1993</year> 12 </cd> 13 </collection> 2 <stub:document xmlns:stub="http://stubbles.org/stub"> 3 <html> 4 <body> 5 <stub:link page="testlinkPage">Das ist ein Stubbles-Link</stub:link> 6 <stub:include href="parts.xml" part="frank"/> 7 </body> 8 </html> 9 </stub:document> trunk/experiments/general/xsl/test.xsl
r183 r184 2 2 xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 3 3 xmlns:php="http://php.net/xsl" 4 exclude-result-prefixes="php"> 4 xmlns:xi="http://www.w3.org/2001/XInclude" 5 xmlns:stub="http://stubbles.org/stub" 6 exclude-result-prefixes="php xi stub"> 7 8 <xsl:import href="copy.xsl"/> 9 <xsl:import href="stub.xsl"/> 10 5 11 <xsl:param name="owner" select="'Frank Kleine'"/> 6 12 <xsl:output method="html" encoding="iso-8859-1" indent="no"/> 13 14 <xsl:template match="/"> 15 <xsl:apply-templates select="/stub:document/node()"/> 16 </xsl:template> 17 18 <!-- 7 19 <xsl:template match="collection"> 8 20 <xsl:copy-of select="php:function('stubXSLCallback::invoke', 'say', 'hello', 'Nico Steiner')"/> Welcome to <xsl:value-of select="$owner"/>'s sweet CD collection! 9 21 <xsl:apply-templates/> 10 22 </xsl:template> 23 11 24 <xsl:template match="cd"> 12 25 <h1><xsl:value-of select="title"/></h1> … … 14 27 <hr /> 15 28 </xsl:template> 29 --> 30 16 31 </xsl:stylesheet> trunk/experiments/general/xsl/transform.php
r183 r184 70 70 stubClassLoader::load('net.stubbles.xml.xsl.stubXSLProcessor'); 71 71 $xslProcessor = new stubXSLProcessor(); 72 $xslProcessor->setXMLDocument(DOMDocument::load($xmlFile)); 73 $xslProcessor->importXSLStylesheet(DOMDocument::load($xslFile)); 72 $doc = DOMDocument::load($xmlFile); 73 #$doc->xinclude(); 74 $xslProcessor->setXMLDocument($doc); 75 $xsl = DOMDocument::load($xslFile); 76 #$xsl->xinclude(); 77 $xslProcessor->importXSLStylesheet($xsl); 74 78 if ($args->isDefined('page') == true) { 75 79 $xslProcessor->setParameter('', 'page', $args->getValue('page')); 76 80 } 77 81 $xslProcessor->registerCallback('say', new SayCallback()); 78 $xslProcessor->transformToURI(($args->isDefined('target') == false) ? ('result.html') : ($args->getValue('target'))); 82 83 $resultDoc = $xslProcessor->transformToDoc(); 84 $resultDoc->xinclude(); 85 print $resultDoc->saveXML(); 86 87 //$xslProcessor->transformToURI(($args->isDefined('target') == false) ? ('result.html') : ($args->getValue('target'))); 79 88 exit(0); 80 89 ?>
