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
posted
0
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 �&�. 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}&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>