File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes XML and Related Technologies and the fly likes doubt in href Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of Practical Unit Testing with TestNG and Mockito this week in the Testing forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Reply Bookmark "doubt in href" Watch "doubt in href" New topic
Author

doubt in href

sethu rajan
Greenhorn

Joined: Jun 22, 2001
Posts: 1
Respected sir,
I am working in java and xml. In my project, I have a situation to select a xml data using xsl within href but have lot of error messages yet.
I browse your web page but I am not clear about it. Please clear my doubt.
problem in : <a href="http://localhost:8080/test/servlet/WebShowMail?msno=<xsl:value-of select='message-no'/>&folder=inbox"><xsl:value-of select="from-id"/></a>
about it :WebShowMail -servlet to be connect .
:msno - parameter of servlet to be pass, which is a
xml data within the tag <message-no>
: I select that xml data by xsl using <xsl:value-of select='message-no'/>
:<xsl:value-of select="from-id"/> -data on which href link to be apply
error :'<' character can't be used in attribute value.
mail to me : sethurajan@rediffmail.com
Please clear my doubt
with hope,
sethu
(sethurajan@rediffmail.com)
Mapraputa Is
Leverager of our synergies
Sheriff

Joined: Aug 26, 2000
Posts: 10065
First, <xsl:value-of> cannot be used in attribute values �as is�, there is a shorcut for it: {Xpath expression}. It means the same as <xsl:value-of select=� Xpath expression�>
Next, �&�� sign cannot appear in an attribute value, it has to be written as �&amp;�.
Suppose your XML is (for example! ):
<?xml version="1.0"?>
<root>
<message-no>120</message-no>
<from-id>GPT20</from-id>
</root>
Then in your XSL stylesheet you should write
<a href="http://localhost:8080/test/servlet/WebShowMail?msno={root/message-no}&amp;folder=inbox">
<xsl:value-of select="root/from-id"/></a>
The output:
<a href="http://localhost:8080/test/servlet/WebShowMail?msno=120&folder=inbox">GPT20</a>

Uncontrolled vocabularies
"I try my best to make *all* my posts nice, even when I feel upset" -- Philippe Maquet
 
 
subject: doubt in href
 
Threads others viewed
XSLT
Displaying an image from xml source element
creating links in XSL
A doubt about Xpath expression
passing parameters
WebSphere development made easy
without the weight of IBM tools
http://www.myeclipseide.com