Changeset 199
- Timestamp:
- 02/02/07 15:36:50 (2 years ago)
- Files:
-
- trunk/experiments/general/xsl/copy.xsl (modified) (1 diff)
- trunk/experiments/general/xsl/main_home.xml (modified) (1 diff)
- trunk/experiments/general/xsl/parts.xml (modified) (1 diff)
- trunk/experiments/general/xsl/stub.xsl (modified) (6 diffs)
- trunk/experiments/general/xsl/test.xsl (modified) (2 diffs)
- trunk/experiments/general/xsl/transform.php (modified) (1 diff)
- trunk/src/main/php/net/stubbles/xml/stubXMLXIncludeStreamWrapper.php (added)
- trunk/src/main/php/net/stubbles/xml/xsl/stubXSLProcessor.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/experiments/general/xsl/copy.xsl
r184 r199 3 3 xmlns:php="http://php.net/xsl" 4 4 xmlns:stub="http://stubbles.org/stub" 5 exclude-result-prefixes="php stub">5 exclude-result-prefixes="php stub"> 6 6 7 <xsl:template match="*|/">7 <xsl:template match="*|/"> 8 8 <xsl:copy> 9 <xsl:apply-templates/> 9 <xsl:copy-of select="./@*"/> 10 <xsl:apply-templates select="node()"/> 10 11 </xsl:copy> 11 12 </xsl:template> trunk/experiments/general/xsl/main_home.xml
r198 r199 4 4 exclude-result-prefixes="stub"> 5 5 6 <part name="content">7 <lang id="default">8 <stub:link page="testlinkPage">Das ist ein Stubbles-Link</stub:link>9 <stub:include href="parts.xml" part="frank"/>10 <stub:image src="stubbles.png" alt="Stubbles Logo"/>11 </lang>12 </part>6 <part name="content"> 7 <lang id="default"> 8 <stub:link page="testlinkPage">Das ist ein Stubbles-Link</stub:link> 9 <stub:include href="parts.xml" part="frank"/> 10 <stub:image src="stubbles.png" alt="Stubbles Logo"/> 11 </lang> 12 </part> 13 13 14 14 </parts> trunk/experiments/general/xsl/parts.xml
r184 r199 1 1 <?xml version="1.0" encoding="iso-8859-1"?> 2 <parts> 2 <parts 3 xmlns:stub="http://stubbles.org/stub" 4 exclude-result-prefixes="stub"> 3 5 <part name="frank"> 4 <lang id="default">5 Frank Kleine6 <lang id="default"> 7 <stub:include href="parts2.xml" part="nico"/> 6 8 </lang> 7 9 </part> 8 10 <part name="nico"> 9 <lang id="default">11 <lang id="default"> 10 12 Nico Steiner 11 13 </lang> trunk/experiments/general/xsl/stub.xsl
r197 r199 5 5 xmlns:stub="http://stubbles.org/stub" 6 6 exclude-result-prefixes="php xi stub"> 7 8 <xsl:template match="stub:document"> 9 <xsl:apply-templates select="node()"/> 10 </xsl:template> 7 11 8 12 <xsl:template match="stub:link"> … … 18 22 19 23 <xsl:template match="stub:maincontent"> 20 <xsl:variable name="path">24 <xsl:variable name="path"> 21 25 <xsl:choose> 22 26 <xsl:when test="@path"> … … 28 32 </xsl:choose> 29 33 </xsl:variable> 30 <xsl:variable name="prefix">34 <xsl:variable name="prefix"> 31 35 <xsl:choose> 32 36 <xsl:when test="@prefix"> … … 38 42 </xsl:choose> 39 43 </xsl:variable> 40 <xsl:variable name="suffix">44 <xsl:variable name="suffix"> 41 45 <xsl:choose> 42 46 <xsl:when test="@suffix"> … … 48 52 </xsl:choose> 49 53 </xsl:variable> 50 <xsl:variable name="part">54 <xsl:variable name="part"> 51 55 <xsl:choose> 52 56 <xsl:when test="@part"> … … 72 76 <xsl:param name="href" select="@href"/> 73 77 <xsl:param name="part" select="@part"/> 74 <xi:include href=" {$href}#xpointer(/parts/part[@name='{$part}']/lang/node())">78 <xi:include href="xinc://{$href}#xpointer(/parts/part[@name='{$part}']/lang/node())"> 75 79 <xi:fallback> 76 80 ERROR: Could not include part <xsl:value-of select="$part"/> in file <xsl:value-of select="$href"/> trunk/experiments/general/xsl/test.xsl
r197 r199 4 4 xmlns:xi="http://www.w3.org/2001/XInclude" 5 5 xmlns:stub="http://stubbles.org/stub" 6 exclude-result-prefixes="php xi stub">6 exclude-result-prefixes="php xi stub"> 7 7 8 8 <xsl:import href="copy.xsl"/> … … 17 17 18 18 <xsl:template match="/"> 19 <xsl:apply-templates select=" /stub:document/node()"/>19 <xsl:apply-templates select="node()"/> 20 20 </xsl:template> 21 21 trunk/experiments/general/xsl/transform.php
r191 r199 72 72 stubClassLoader::load('net.stubbles.xml.xsl.util.stubXSLImageDimensions'); 73 73 $xslProcessor->registerCallback('image', new stubXSLImageDimensions(new stubDomXMLStreamWriter())); 74 74 75 stubClassLoader::load('net.stubbles.xml.stubXMLXIncludeStreamWrapper'); 76 stubXMLXIncludeStreamWrapper::register(); 77 stubXMLXIncludeStreamWrapper::setXSLProcessor($xslProcessor); 78 stubXMLXIncludeStreamWrapper::setCachePath(dirname(__FILE__) . '/cache'); 79 75 80 $resultDoc = $xslProcessor->transformToDoc(); 76 81 $resultDoc->xinclude(); 77 82 print $resultDoc->saveXML(); 78 79 //$xslProcessor->transformToURI(($args->isDefined('target') == false) ? ('result.html') : ($args->getValue('target'))); 83 84 $dirIt = new DirectoryIterator(dirname(__FILE__) . '/cache/xml'); 85 foreach ($dirIt as $file) { 86 if ($file->isDot() == true) { 87 continue; 88 } 89 90 unlink($file->getPathname()); 91 } 80 92 exit(0); 81 93 ?> trunk/src/main/php/net/stubbles/xml/xsl/stubXSLProcessor.php
r180 r199 42 42 */ 43 43 protected $callbacks = array(); 44 /** 45 * list of used stylesheets 46 * 47 * @var array<DOMDocument> 48 */ 49 protected $stylesheets = array(); 44 50 45 51 /** … … 76 82 public function importXSLStylesheet(DOMDocument $stylesheet) 77 83 { 84 $this->stylesheets[] = $stylesheet; 78 85 $this->xsltProcessor->importStylesheet($stylesheet); 86 } 87 88 /** 89 * returns the list of used stylesheets 90 * 91 * @return array<DOMDocument> 92 */ 93 public function getStylesheets() 94 { 95 return $this->stylesheets; 79 96 } 80 97 … … 166 183 $this->parameters[$nameSpace] = array_merge($this->parameters[$nameSpace], $params); 167 184 return true; 185 } 186 187 /** 188 * returns all parameters for the given namespace3 189 * 190 * @param string $nameSpace 191 * @return array 192 */ 193 public function getParameters($nameSpace) 194 { 195 if (isset($this->parameters[$nameSpace]) == true) { 196 return $this->parameters[$nameSpace]; 197 } 198 199 return array(); 200 } 201 202 /** 203 * returns a list of all used namespaces 204 * 205 * @return array 206 */ 207 public function getParameterNameSpaces() 208 { 209 return array_keys($this->parameters); 168 210 } 169 211
