XSL Nesting Problem!
-
Hi All! I need to emulate the HTML <B> and <EM> tags complete with all attributes and event handlers for a little project of mine and everything works fine when these elements are seperate, Here's my xsl stylesheet:
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"><xsl:template match="/HTML/BODY/EM">
<EM ID="{@ID}" CLASS="{@CLASS}" TITLE="{@TITLE}" STYLE="{@STYLE}" DIR="{@DIR}" LANG="{@LANG}" ONCLICK="{@ONCLICK}" ONDBLCLICK="{@ONDBLCLICK}" ONMOUSEDOWN="{@ONMOUSEDOWN}" ONMOUSEUP="{@ONMOUSEUP}" ONMOUSEOVER="{@ONMOUSEOVER}" ONMOUSEMOVE="{@ONMOUSEMOVE}" ONMOUSEOUT="{@ONMOUSEOUT}" ONKEYPRESS="{@ONKEYPRESS}" ONKEYDOWN="{@ONKEYDOWN}" ONKEYUP="{@ONKEYUP}"><xsl:value-of select="self::EM"/></EM>
</xsl:template><xsl:template match="/HTML/BODY/B">
<B ONCLICK="{@ONCLICK}" ONDBLCLICK="{@ONDBLCLICK}" ONMOUSEDOWN="{@ONMOUSEDOWN}" ONMOUSEUP="{@ONMOUSEUP}" ONMOUSEOVER="{@ONMOUSEOVER}" ONMOUSEMOVE="{@ONMOUSEMOVE}" ONMOUSEOUT="{@ONMOUSEOUT}" ONKEYPRESS="{@ONKEYPRESS}" ONKEYDOWN="{@ONKEYDOWN}" ONKEYUP="{@ONKEYUP}" ID="{@ID}" CLASS="{@CLASS}" TITLE="{@TITLE}" STYLE="{@STYLE}" DIR="{@DIR}" LANG="{@LANG}" ><xsl:value-of select="self::B"/></B>
</xsl:template></xsl:stylesheet>
Now this works fine when <B> and <EM> are seperate, however when one tag is inside the other the result is no formatting at all! The problem is that the match attribute of each xsl:template tag is only neing applied to B and EM tags in the BODY, is there any way I can apply the B and EM templates to the BODY and to all infinetly deeper nesting levels? Thanks! MrWolfy :-D
-
Hi All! I need to emulate the HTML <B> and <EM> tags complete with all attributes and event handlers for a little project of mine and everything works fine when these elements are seperate, Here's my xsl stylesheet:
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"><xsl:template match="/HTML/BODY/EM">
<EM ID="{@ID}" CLASS="{@CLASS}" TITLE="{@TITLE}" STYLE="{@STYLE}" DIR="{@DIR}" LANG="{@LANG}" ONCLICK="{@ONCLICK}" ONDBLCLICK="{@ONDBLCLICK}" ONMOUSEDOWN="{@ONMOUSEDOWN}" ONMOUSEUP="{@ONMOUSEUP}" ONMOUSEOVER="{@ONMOUSEOVER}" ONMOUSEMOVE="{@ONMOUSEMOVE}" ONMOUSEOUT="{@ONMOUSEOUT}" ONKEYPRESS="{@ONKEYPRESS}" ONKEYDOWN="{@ONKEYDOWN}" ONKEYUP="{@ONKEYUP}"><xsl:value-of select="self::EM"/></EM>
</xsl:template><xsl:template match="/HTML/BODY/B">
<B ONCLICK="{@ONCLICK}" ONDBLCLICK="{@ONDBLCLICK}" ONMOUSEDOWN="{@ONMOUSEDOWN}" ONMOUSEUP="{@ONMOUSEUP}" ONMOUSEOVER="{@ONMOUSEOVER}" ONMOUSEMOVE="{@ONMOUSEMOVE}" ONMOUSEOUT="{@ONMOUSEOUT}" ONKEYPRESS="{@ONKEYPRESS}" ONKEYDOWN="{@ONKEYDOWN}" ONKEYUP="{@ONKEYUP}" ID="{@ID}" CLASS="{@CLASS}" TITLE="{@TITLE}" STYLE="{@STYLE}" DIR="{@DIR}" LANG="{@LANG}" ><xsl:value-of select="self::B"/></B>
</xsl:template></xsl:stylesheet>
Now this works fine when <B> and <EM> are seperate, however when one tag is inside the other the result is no formatting at all! The problem is that the match attribute of each xsl:template tag is only neing applied to B and EM tags in the BODY, is there any way I can apply the B and EM templates to the BODY and to all infinetly deeper nesting levels? Thanks! MrWolfy :-D
-
Hi All! I need to emulate the HTML <B> and <EM> tags complete with all attributes and event handlers for a little project of mine and everything works fine when these elements are seperate, Here's my xsl stylesheet:
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"><xsl:template match="/HTML/BODY/EM">
<EM ID="{@ID}" CLASS="{@CLASS}" TITLE="{@TITLE}" STYLE="{@STYLE}" DIR="{@DIR}" LANG="{@LANG}" ONCLICK="{@ONCLICK}" ONDBLCLICK="{@ONDBLCLICK}" ONMOUSEDOWN="{@ONMOUSEDOWN}" ONMOUSEUP="{@ONMOUSEUP}" ONMOUSEOVER="{@ONMOUSEOVER}" ONMOUSEMOVE="{@ONMOUSEMOVE}" ONMOUSEOUT="{@ONMOUSEOUT}" ONKEYPRESS="{@ONKEYPRESS}" ONKEYDOWN="{@ONKEYDOWN}" ONKEYUP="{@ONKEYUP}"><xsl:value-of select="self::EM"/></EM>
</xsl:template><xsl:template match="/HTML/BODY/B">
<B ONCLICK="{@ONCLICK}" ONDBLCLICK="{@ONDBLCLICK}" ONMOUSEDOWN="{@ONMOUSEDOWN}" ONMOUSEUP="{@ONMOUSEUP}" ONMOUSEOVER="{@ONMOUSEOVER}" ONMOUSEMOVE="{@ONMOUSEMOVE}" ONMOUSEOUT="{@ONMOUSEOUT}" ONKEYPRESS="{@ONKEYPRESS}" ONKEYDOWN="{@ONKEYDOWN}" ONKEYUP="{@ONKEYUP}" ID="{@ID}" CLASS="{@CLASS}" TITLE="{@TITLE}" STYLE="{@STYLE}" DIR="{@DIR}" LANG="{@LANG}" ><xsl:value-of select="self::B"/></B>
</xsl:template></xsl:stylesheet>
Now this works fine when <B> and <EM> are seperate, however when one tag is inside the other the result is no formatting at all! The problem is that the match attribute of each xsl:template tag is only neing applied to B and EM tags in the BODY, is there any way I can apply the B and EM templates to the BODY and to all infinetly deeper nesting levels? Thanks! MrWolfy :-D
-
Hi and Thanks! Thanks Frank! The code works perfectly! Problem Solved! Thanks Again! MrWolfy :-D
-
Hi and Thanks! Thanks Frank! The code works perfectly! Problem Solved! Thanks Again! MrWolfy :-D
You're welcome. In case you can read German or French, this is where I learnt it all: http://selfhtml.org/ I hardly ever use websites in my native language when it comes to software development cause anglophone sites are abundant and (when they have a forum) well populated, but this one is so good I took it on as my default HTML and XSL reference.