Cocoon/a1 4.xsl
From Fxp Wiki
<?xml version="1.0" encoding="ISO-8859-1"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/"> <html> <head></head><body> <script> function add_notion(notion) { window.opener.top.document.frames['gen'].frames['beta'].document.forms['f1'].elements[0].value= notion } function display2() { var range = document.selection.createRange(); var str = range.text; window.opener.top.document.frames['gen'].frames['beta'].document.forms['f1'].elements[1].value = str; } </script> <xsl:apply-templates/> </body></html> </xsl:template> <xsl:template match="div"> <div> <xsl:attribute name="onclick">add_notion("<xsl:value-of select="@id"/>")</xsl:attribute> <xsl:attribute name="onmouseup">display2()</xsl:attribute> <xsl:apply-templates/> </div> </xsl:template> <xsl:template match="rs"> <i> <xsl:apply-templates/> </i> </xsl:template> <xsl:template match="div[@id='N01-1']"> <xsl:apply-templates mode="insert-data"/> </xsl:template> <xsl:template match="div[@id='N01-1']/text()" mode="insert-data"> <xsl:call-template name="insert1"> <xsl:with-param name="insert"> <xsl:value-of select="."/> </xsl:with-param> </xsl:call-template> </xsl:template> <xsl:template match="div[@id='N01-1']/title" mode="insert-data"> <h1> <xsl:value-of select="."/> <xsl:apply-templates/> </h1> </xsl:template> <xsl:template name="insert1"> <xsl:param name="insert"/> <xsl:call-template name="insert2"> <xsl:with-param name="insert"> <xsl:value-of select="substring-before($insert, 'personnes')"/> <font color='#006600'>http://www.dpawson.co.uk/xsl/sect2/replace.html</font> personnes <xsl:value-of select="substring-after($insert, 'personnes')"/> </xsl:with-param> </xsl:call-template> </xsl:template> <xsl:template name="insert2"> <xsl:param name="insert"/> <xsl:call-template name="last"> <xsl:with-param name="insert"> <xsl:value-of select="substring-before($insert, 'veut')"/> <font color='red'>HELLO</font> veut <xsl:value-of select="substring-after($insert, 'veut')"/> </xsl:with-param> </xsl:call-template> </xsl:template> <xsl:template name="last"> <xsl:param name="insert"/> <xsl:value-of select="$insert"/> </xsl:template> </xsl:stylesheet>
Categories: Cocoon | Xsl
