Changeset 184

Show
Ignore:
Timestamp:
02/01/07 16:07:12 (1 year ago)
Author:
nsteiner
Message:

basic stub templates

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/experiments/general/xsl/test.xml

    r183 r184  
    11<?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  
    22    xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
    33    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   
    511  <xsl:param name="owner" select="'Frank Kleine'"/> 
    612  <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  <!-- 
    719  <xsl:template match="collection"> 
    820    <xsl:copy-of select="php:function('stubXSLCallback::invoke', 'say', 'hello', 'Nico Steiner')"/> Welcome to <xsl:value-of select="$owner"/>'s sweet CD collection!  
    921    <xsl:apply-templates/> 
    1022  </xsl:template> 
     23   
    1124  <xsl:template match="cd"> 
    1225    <h1><xsl:value-of select="title"/></h1> 
     
    1427    <hr /> 
    1528  </xsl:template> 
     29  --> 
     30 
    1631</xsl:stylesheet> 
  • trunk/experiments/general/xsl/transform.php

    r183 r184  
    7070stubClassLoader::load('net.stubbles.xml.xsl.stubXSLProcessor'); 
    7171$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); 
    7478if ($args->isDefined('page') == true) { 
    7579    $xslProcessor->setParameter('', 'page', $args->getValue('page')); 
    7680} 
    7781$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(); 
     85print $resultDoc->saveXML(); 
     86   
     87//$xslProcessor->transformToURI(($args->isDefined('target') == false) ? ('result.html') : ($args->getValue('target'))); 
    7988exit(0); 
    8089?>