aspose file tools*
The moose likes XML and Related Technologies and the fly likes xsl:value-of Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "xsl:value-of" Watch "xsl:value-of" New topic
Author

xsl:value-of

Gemini Moses
Ranch Hand

Joined: Jan 04, 2001
Posts: 245
Please help me !!
What is wrong with this style sheet ?
When I apply this to the XML document given It does not print the urgent on IE?
What am I missing?
Please help me this is urgent..
Thanks in advance.

my xml document,
<Meeting>
<date/>
<Subject> URGENT </Subject>
</Meeting>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<!-- Root template -->
<xsl:template match="/">
<html>
<head>
Meeting.xml
</head>
<body>
<xsl:value-of select="Subject"/>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
Gemini Moses
Ranch Hand

Joined: Jan 04, 2001
Posts: 245
Instead the output in browser is
Subject
and not the content of Subject(i.e. URGENT)
???
Mapraputa Is
Leverager of our synergies
Sheriff

Joined: Aug 26, 2000
Posts: 10065
You do not use old version of MSXML? Anyway, try this
<xsl:value-of select="Meeting/Subject"/>
instead of
<xsl:value-of select="Subject"/>


Uncontrolled vocabularies
"I try my best to make *all* my posts nice, even when I feel upset" -- Philippe Maquet
Gemini Moses
Ranch Hand

Joined: Jan 04, 2001
Posts: 245
Thanks Map!! It worked...
Thanks a lot. :-)
Gemini Moses
Ranch Hand

Joined: Jan 04, 2001
Posts: 245
Hello Map,
<ul>
<xsl:for-each select="Meeting/Open_Issues">
<li> <xsl:value-of select="Issues"/> /li>
</xsl:for-each>
</ul>
now this portion of my style sheet is not taking all the issues in this xml document but overwriting the latest one?
Am I missing something??
<Open_Issues>
<issues> aaaa <issues>
<issues> bbbb </issues>
<issues> cccc </issues>
</open_issues>
what I want is unordered(bulleted) list of all
aaaa
bbbb
cccc
whereas I am getting just aaaa
???
Thanks in advance
Mapraputa Is
Leverager of our synergies
Sheriff

Joined: Aug 26, 2000
Posts: 10065
That�s because your <xsl:for-each> statement will be executed for each "open_issues" element, and there is only one, so it will work once and output the first "issues" element. Instead, put
<xsl:template match="Meeting">
...
<ul>
<xsl:for-each select="Meeting/open_issues/issues">
<li> <xsl:value-of select="."/></li>
</xsl:for-each>
</ul>
...
</xsl:template>
- that should work
Gemini Moses
Ranch Hand

Joined: Jan 04, 2001
Posts: 245
Yes It worked.
This is really cool site.
Thanks once again. :-)

Tell me if my way of writing style sheet is wrong . I mean I just felt I am using so much of HTML , Can I do it in some other better way. But I dont think I am wrong.
Please tell me if I need to imrpove on the way I am doing it.
Mapraputa Is
Leverager of our synergies
Sheriff

Joined: Aug 26, 2000
Posts: 10065
Did not find anything horribly wrong in your XSLT, so all I can tell are general recommendations XSLT is a functional language and it employes different programming paradigm. For this reason, many of our habitual tricks will not work. It is worth to spend some time, to read a book (Khun Yee Fung�s �XSLT� is good) and to learn concepts. Otherwise a lot of frustration will be our the only reward... After that, to look at classical patterns of XSLT thinking is very useful. Unfortunately, it will take a while to get used to think in a different way, but it means we will think better!
Gemini Moses
Ranch Hand

Joined: Jan 04, 2001
Posts: 245
Can u help me to clarify my doubt?
Whatever I am doing here needs me to use HTML tags.
Is xsl:fo an alternative to achieve all this???
Please help
Thanks
Mapraputa Is
Leverager of our synergies
Sheriff

Joined: Aug 26, 2000
Posts: 10065
You need to use HTML tags because you need to convert your XML into HTML to show it in a browser. I am not sure XSL:FO is a good alternative. One thing, it is said to be more complex than XSLT. Next, it requires special tools to be rendered. I am not aware of browsers level of support for XSL:FO, but even if last versions support it, what if your clients use old versions? HTML is still much more reliable media.
HTML inclusions in XSL stylesheets are normal practice if these stylesheets are intended for "XML to HTML" conversion. Nothing wrong with it

[This message has been edited by Mapraputa Is (edited June 14, 2001).]
Gemini Moses
Ranch Hand

Joined: Jan 04, 2001
Posts: 245
Thanks Map for your valuable time.
I will read the xslt book you suggested.
Thanks
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: xsl:value-of