Hallo Forum,
ich versuche gerade eine PHP-Silbentrennung in mein XSL einzubetten. Die Quelle ist http://phphyphenator.yellowgreen.de/. Das klappt soweit ganz gut, d.h. * wird richtig eingefügt - nur leider wird es auch mitausgegeben.
Also z.B.: Sil*ben*trenn*ung
Im Quelltext steht das * in dieser Form: ­
Hier lade ich den XSLT-Prozess:
Das ist der entsprechende Quellcode, meines XSL (Namespace für php:function ist eingebettet):
Ich danke Euch für Eure Hilfe.
Gruss
Dom
ich versuche gerade eine PHP-Silbentrennung in mein XSL einzubetten. Die Quelle ist http://phphyphenator.yellowgreen.de/. Das klappt soweit ganz gut, d.h. * wird richtig eingefügt - nur leider wird es auch mitausgegeben.
Also z.B.: Sil*ben*trenn*ung
Im Quelltext steht das * in dieser Form: ­
Hier lade ich den XSLT-Prozess:
Code:
header('content-type: text/html; charset=utf-8'); $GLOBALS["language"] = "de"; $GLOBALS["path_to_patterns"] = "./patterns/"; $GLOBALS["dictionary"] = "dictionary.txt"; $GLOBALS["hyphen"] = "*"; $GLOBALS["leftmin"] = 2; $GLOBALS["rightmin"] = 2; $GLOBALS["charmin"] = 2; $GLOBALS["charmax"] = 10; $GLOBALS["exclude_tags"] = array("code", "pre", "script", "style"); include("./hyphenation.php"); function hyphen($text) { $content = hyphenation($text); //return str_replace('/^­/', '*', $text); return $content; } $sXslFile = './xslt/idml2html_bound.xsl'; //Wahl des Spreadfiles $sXmlFile = './publish/' . $docname . '/Spreads/Spread_' . $idNumber . '.xml'; //XSLT Process $xml_Doc = new DOMDocument(); $xml_Doc->load($sXmlFile); $xslt = new XSLTProcessor; $xslt->registerPHPFunctions(); $xslt->importStyleSheet(DomDocument::load($sXslFile)); //Ausgabe des HTML-Codes $output = $xslt->transformToXML($xml_Doc); echo $output;
Code:
[...] <xsl:for-each select="*"> <xsl:if test="ancestor-or-self::Content"> <xsl:value-of select="php:function('hyphen', string())"/> </xsl:if> <xsl:if test="ancestor-or-self::Br"> <br /> </xsl:if> </xsl:for-each> [...]
Gruss
Dom
Comment