|
-
Mar 6th, 2003, 10:36 AM
#1
Thread Starter
Addicted Member
xml - resolve tags or display as html
XML file:
- <root>
<product id="1" text="<h1>Type</h1> The <b>name</b> of..."/>
<product id="2" text="<h1>Type</h1> The name of..."/>
...
</root>
i want to display the text, using the headers tags and the bold tags. if i use following xsl
<xsl:template match="/">
<xsl:for-each select="root/product">
<xsl:value-of select="@textl"/>
</xsl:for-each>
</xsl:template>
i just get the text displayed, but the tags are not resolved.
how can i display the text as html?
-
Mar 6th, 2003, 10:41 AM
#2
First, I'd rethink the way the XML is laid out.....
<root>
<product id="1" type="Type" name="Name">Description of the item</product>
<product id="2" type="Type" name="Name">Description of the item</product>
</root>
Then, the XSL looks like this:
<xsl:template match="/">
<xsl:for-each select="root/product">
<h1><xsl:value-of select="@type"/>
</h1> -- <b><xsl:value-of select="@name"/></b> -- <xsl:value-of select="."/>
</xsl:for-each>
</xsl:template>
Off hand I'd also suggest you look at how you want it to display.... the sample given just simply displays the text, w/o any regard for lining things up....
-
Mar 6th, 2003, 10:45 AM
#3
PowerPoster
I agree with Techngnome. Also, if you try to parse your xml document, you will find that it is invalid. When using xml attributes, the less than and greater than signs are not valid characters. You could use escape characters, but you should really implement the structure stated above.
-
Mar 7th, 2003, 02:57 AM
#4
Thread Starter
Addicted Member
well, this is the xml i got (i'm using a 'virtual directory' in IIS and querying a table on sql server with 'SELECT lijn_lastenboek_nl FROM tbl_alg_lijn WHERE lijn_ID like 'euro%' FOR XML AUTO')
this gives me following xml:
Code:
<?xml version="1.0" ?>
- <!-- <?xml-stylesheet type='text/xsl' href='sqllijn.xsl'?> -->
- <root>
<tbl_alg_lijn lijn_lastenboek_nl="<h5>Type</h5> Het kraanwerk is van het <b>ééngreepstype</b> met één hendel, die temperatuur en debiet regelt. Het bovendeel is kantelend. <h5>Werking</h5> Het regelsysteem voor debiet en temperatuur bestaat uit twee horizontaal geplaatste keramische schijven (aluminiumoxide). De ..." />
<tbl_alg_lijn lijn_lastenboek_nl="<html><h5>Type</h5> Het zelfsluitend ééngatskraanwerk (mengkraan met menging of kraan zonder menging) voor wastafel is van het elektronisch type. De stroomvoorziening gebeurt door middel van een 6V lithiumbatterij, type CRP2. De ..." />
now i want this to be displayed as real html, not just the text with the tags. how can i do this? the tags are in the text that is stored in the database.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|