|
[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] recursive call of template - how to find parents
Hello,
I go recursively through a template and print the names of the xml-elements. That works fine (thanks for your help in this newsgroup). But now I need to output another attribute with every element, and I need to output this attribute also from all its parents. How can I find out if there´s still a parent left? I give you an example of my xml-File my xslt-code and the desired output. Thanks a lot
############## the xsl template ################# <xsl:template name="sitemap">
<ul>
<xsl:for-each select="//homepage/topic">
<li>
<xsl:value-of select="."/>
</li>
<ul>
<xsl:apply-templates select="topic"/>
</ul>
</xsl:for-each>
</ul>
</xsl:template>
<xsl:template match="topic">
<li>
<xsl:value-of select="."/>
<xsl:if test="topic">
<ul>
<xsl:apply-templates select="topic"/>
</ul>
</xsl:if>
</li>
</xsl:template>##################### the desired output ################### <ul xmlns=""> <li> <a href="asdf">point1 </a> <ul><li> <a href="asdf/asdf1"> subpoint1 <ul><li> <a href="asdf/asdf1/asdf2">subsubpoint1</li> ...... and so on. So you see, the the <a href=..... is the problem. How can I go up in the recusively called template and always add the filename attribute, starting from the uppper mostt topic element? So if I´m in subsubsubpoint, I´d like to have the fileanmes beginning from the uppermost topic element: <a href=asdf/asdf1/asdf2/asdf3> Thanks a lot Michael XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|

Cart








