[oXygen-user] Can I use call-templates when nested in multiple choose when when ?
McGibbney, Lewis John
Lewis.McGibbney at gcu.ac.uk
Sat Mar 10 09:26:49 CST 2012
Hi Everyone,
I have the following template
<xsl:template name ="createBody" match="html:html/html:body">
... some stuff...
...
<xsl:choose>
<xsl:when test="path/to/particular/html/element/attribute">
<xsl:when test="path/to/another/html/element/attribute">
<xsl:call-template name="createStandardHead"/>
</xsl:when>
</xsl:when>
<xsl:otherwise>
do some stuff
</xsl:otherwise>
Let me explain a bit,
I wish to call the createStandardHeader template if the XHTML looks like this
<body>
<div id="content">
<div id="page1" class="page css-gen1">
<div id="Layer1">6.1
</div>
<div style="width:205pt;height:12pt;left:34pt;top:33pt">
<div style="top:9pt">
<span class="css-gen2">
<span>Part 1</span>
</span>
</div>
</div>
<div style="width:56pt;height:76pt;left:63pt;top:81pt">
<a name="energ61" id="energ61"></a>
<div style="left:5pt;top:10pt">
<span class="css-gen3">
<span class="css-gen4">standard</span>
</span>
</div>
<div style="top:51pt">
<span class="css-gen5">
<span class="css-gen4">mandatory</span>
</span>
</div>
</div>
e.g if
html:html/html:body/html:div/html:div/html:div[2]/html:div[1]/html:span[@class='css-gen3']
and
html:html/html:body/html:div/html:div/html:div[2]/html:div[2]/html:span[@class='css-gen5']
then call-template createStandardHead, which will process the text() values for these elements accordingly.
My question is, is this possible? I've tried altering, changing it quite a bit and can quite seem to crack it. One final thing, REGARDLESS of whether the createStandardHeader template is called or not it is imperative that I process the stuff in <xsl:otherwise> e.g after I perform the check for the above XHTML structure.
Thanks in advance for any help. Have a great weekend.
Kind Regards
Lewis
Glasgow Caledonian University is a registered Scottish charity, number SC021474
Winner: Times Higher Education’s Widening Participation Initiative of the Year 2009 and Herald Society’s Education Initiative of the Year 2009.
http://www.gcu.ac.uk/newsevents/news/bycategory/theuniversity/1/name,6219,en.html
Winner: Times Higher Education’s Outstanding Support for Early Career Researchers of the Year 2010, GCU as a lead with Universities Scotland partners.
http://www.gcu.ac.uk/newsevents/news/bycategory/theuniversity/1/name,15691,en.html
More information about the oXygen-user
mailing list