473,320 Members | 1,694 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

How do you nest templates in XSLT?

I know you CAN'T nest templates, so what would be the logic to use
otherwise?

Here's what I am doing:

I have a template set to match a specific node based on one of it's
elements.

If it finds it, it renders it. I then want to see if that node has any
children. If it does have children, render that. Since I can used a nested
template to see it if has children, what logic/method should I be using?

-Darrel
Nov 12 '05 #1
1 6926
> If it finds it, it renders it. I then want to see if that node has any
children. If it does have children, render that. Since I can used a nested
template to see it if has children, what logic/method should I be using?


I hate when I find the answer just after posting. ;o)

I think this is what I want to nest an 'if it has a child' type of logic:

<xsl:if test="page">
<ul>
<xsl:for-each select="page">
<li><xsl:value-of select="linkTitle" /></li>
</xsl:for-each>
</ul>
</xsl:if>

In this case, if the node the xls:if is in has a child node of 'page' then
for each page, list the linkTitle element.

Cool!

Now...off to figure out parents and siblings...

-Darrel
Nov 12 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Stefan Siegl | last post by:
Hello, I am trying to learn XSLT to use it in another project. I start reading the book "Java and XSLT" and tried the examples and they are went quite fine (how suprising *g*). Then I tried...
2
by: Martin | last post by:
Hallo, can you help me writing a generic xslt transformation (useable with xsql from oracle)? The problem is how to get the escaping characters .... === INPUT-File in.xml <?xml version =...
0
by: Marcel Stör | last post by:
Hi all, For one customer we need to transform some 100 business forms (registration forms, etc.) into XSLT:FO templates - our application will produce PDF documents. Up to now our intern has...
2
by: Thomas Sommer | last post by:
Hi, I think the following is not possible but maybe (hopefully) I am wrong: I have: <xsl:param name="test"> <tag1>asdfasdf</tag1> <tag2>asdfasdf</tag2> </xsl:param>
3
by: Blaise Garant | last post by:
Hi I've made a stylesheet to transform my data into XSL-FO. This stylesheet used to work with MSXSL 4.0 but I've got some issues in ..NET. First, I changed removed all the "node-set()" function...
2
by: jimbo_vr5 | last post by:
Hey I think i've figured out the idea behind apply-templates. But going through the tutorial on <http://www.w3schools.com/xsl/xsl_apply_templates.asp> theres simply just something that i dont...
3
by: tschwartz | last post by:
I'm trying to write a stylesheet which removes nodes which are empty as a result of other template processing. For example, given the following xml, I'd like to: - remove all "b" elements -...
3
by: abhishek.smu | last post by:
Given an XML like: <root> <node>8</node> <node>21</node> <node>-7</node> <node>13</node> <node>43</node> <node>2</node> </root>
2
by: Francesc001 | last post by:
I will try to explain a little which is the functionality that we are looking for. We need a tool to create XSL templates able to transform plane text to XML. As source we have strings where...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.