N
ned786
Hello,
I'm trying to solve an XSLT problem, and I'm hoping someone can give a
little guidance. I am transforming XML to HTML.
Here's an example of the XML file I'm dealing with, greatly simplified:
-----------------
<root>
<object name="a">
<item name="a1">Text here</item>
<item name="readonlya2">Text here</item>
<item name="a3">Text here</item>
<item name="readonlya4">Text here</item>
<item name="a5">Text here</item>
</object>
<object name="b">
<item name="b1">Text here</item>
<item name="b2">Text here</item>
<item name="b3">Text here</item>
<item name="b4">Text here</item>
<item name="b5">Text here</item>
</object>
</root>
----------------------
An <object> element contains several <item> elements. I handle each
<object> separately.
If an <object> contains no read-only <item> elements (identified by
name="readonly.."), I want to print "None" in the HTML output.
If there is one or more read-only <item> in an <object>, I will display
those read-only <item> elements in an HTML table.
It seemed simple, but I have tried using a key, and a recursive
template, and anything else I could think of. I can't find out if there
are any read-only <item>s before putting something in the result tree.
If I could set a global variable from within a template, then it would
be easy to check that variable to tell whether or not to create a table
or print "None." But that is apparently not possible.
Have I missed something?
Thanks!
Mark
I'm trying to solve an XSLT problem, and I'm hoping someone can give a
little guidance. I am transforming XML to HTML.
Here's an example of the XML file I'm dealing with, greatly simplified:
-----------------
<root>
<object name="a">
<item name="a1">Text here</item>
<item name="readonlya2">Text here</item>
<item name="a3">Text here</item>
<item name="readonlya4">Text here</item>
<item name="a5">Text here</item>
</object>
<object name="b">
<item name="b1">Text here</item>
<item name="b2">Text here</item>
<item name="b3">Text here</item>
<item name="b4">Text here</item>
<item name="b5">Text here</item>
</object>
</root>
----------------------
An <object> element contains several <item> elements. I handle each
<object> separately.
If an <object> contains no read-only <item> elements (identified by
name="readonly.."), I want to print "None" in the HTML output.
If there is one or more read-only <item> in an <object>, I will display
those read-only <item> elements in an HTML table.
It seemed simple, but I have tried using a key, and a recursive
template, and anything else I could think of. I can't find out if there
are any read-only <item>s before putting something in the result tree.
If I could set a global variable from within a template, then it would
be easy to check that variable to tell whether or not to create a table
or print "None." But that is apparently not possible.
Have I missed something?
Thanks!
Mark