This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How do I recover the String

 
Tony Yan
Ranch Hand
Posts: 170
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Don't ask why. But the database I got has a string of something like
<b>Item 1</b>
So I have to convert it into xml like this:
<b>Item 1</b>
After transform with XSL, it will output the same into HTML's source
<b>Item 1</b>
Then in browser it looks like
<b>Item 1</b>
Of course, you guessed right. That isn't what we wanted. We want Item 1 to be bold in html. In otherwords, we want <b>Item 1</b> to be in the source of Html.
How do you this? I guess I have to convert < and > into < and > into xml as required by xml. Can I do soemthing in XSLT to convert them back to < and > ?
thx
-TY
 
Balaji Loganathan
author and deputy
Bartender
Posts: 3150
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We need a decoder to understand your question.
 
Tony Yan
Ranch Hand
Posts: 170
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Don't ask why. But the database I got has a string of something like
<b>Item 1</b>
So I have to convert it into xml like this:
<![CDATA[
<b>Item 1</b>
]]>
After transform with XSL, it will output the same into HTML's source
<![CDATA[
<b>Item 1</b>
]]>
Then in browser it looks like
<b>Item 1</b>
Of course, you guessed right. That isn't what we wanted. We want Item 1 to be bold in html. In otherwords, we want <b>Item 1</b> to be in the source of Html.
How do you this? I guess I have to convert < and > into < and > into xml as required by xml. Can I do soemthing in XSLT to convert them back to < and > ?
thx
-TY
 
Tony Yan
Ranch Hand
Posts: 170
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry for the confusion. In the last post, what ever in CDATA
< should be & lt ; (ignore the space)
> should be & gt ; (ignore the space)

Thx
 
Balaji Loganathan
author and deputy
Bartender
Posts: 3150
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Toni,
Actually why u need to convert it into XML,why don't you read the database directly,retrieve the specific details,write to a HTML file.All this can be done using java or whatever language you use.
If you learning how to do such process in XSLT may be this FAQ will help you http://www.dpawson.co.uk/xsl/xslfaq.html
 
Tony Yan
Ranch Hand
Posts: 170
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the input. We are actually doing what you said. But we also are trying out the xsl solution.
As for my problem, I have used the CDATA section to put all my data in w/o coverting. In xsl, I used disable-output-escaping="yes" to output whatever is in CDATA. This seems to work fine now. So basically, whatever is in DB as raw string will go directly into html source. This actually save some process time.
Thanks again.
-Tony
 
Balaji Loganathan
author and deputy
Bartender
Posts: 3150
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Tony,
I still don't see the need for XSL their,can you tell me why you opted xsl,because the conversion done using xsl may slowdown your processing time escp., when you use XALAN,but with MSXML,it may be fast.
Regards
Balaji
 
Tony Yan
Ranch Hand
Posts: 170
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There are a lot of business presentation logic to my data. In other words, the current Java solution are also slow with data manipulation. Indeed, the transformation is slow too for xalan (needs improve on my .xsl). But the speed are about the same for them. But for the developers, the xsl solution seems more flexible when users ask for changes in presentation. And belive me the codes are much simpler with xsl. I hate to change the servlet when they want to have an extra table or diff. look. Just change it in .xsl file.
Regards,
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic