I want to use HTML tags within XML file which is parsed by XSL on server. But in result it displays HTML tags as it is, those HTML tags which i want to be interpreted without mentioning them in XSL file should be interpreted as HTML tags. Could anybody tell me the solution for this problem. e.g., in XML document I have <Title>This is a sample title named <B>Samle Title</B></Title>. i mention Title tag in XSL but cann't use <B> tag, since this part is generated dynamically. i hope i could express my question clearly. any help.... ------------------ [This message has been edited by tanya (edited July 20, 2001).]
Mapraputa Is
Leverager of our synergies
Sheriff
Joined: Aug 26, 2000
Posts: 10065
posted
0
Hi Tanya! If what you want is to copy HTML tags from XML document to output HTML, then you can write a generic template, which will match HTML tags and copy them: <xsl:template match="B | P | ... "> <!�put here HTML tags you use --> <xsl:copy-of select="."/> </xsl:template> The whole stylesheet: <?xml version="1.0"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/"> <html> <body> <xsl:apply-templates select="./Title"/> </body> </html> </xsl:template> <xsl:template match="B | P "> <xsl:copy-of select="."/> </xsl:template> </xsl:stylesheet>
output: <html> <body>This is a sample title named <B>Samle Title</B> </body> </html>
Tanya, Your name does not comply with the JavaRanch naming policy. Please spare a moment and re-register with a name that meets the requirements. Thanks! Ajith
Open Group Certified Master IT Architect.
Sun Certified Architect(SCEA).
tanya
Greenhorn
Joined: Jul 20, 2001
Posts: 2
posted
0
Originally posted by Mapraputa Is: Hi Tanya! If what you want is to copy HTML tags from XML document to output HTML, then you can write a generic template, which will match HTML tags and copy them: <xsl:template match="B | P | ... "> <!�put here HTML tags you use --> <xsl:copy-of select="."/> </xsl:template> [b]The whole stylesheet: <?xml version="1.0"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/"> <html> <body> <xsl:apply-templates select="./Title"/> </body> </html> </xsl:template> <xsl:template match="B | P "> <xsl:copy-of select="."/> </xsl:template> </xsl:stylesheet>
output: <html> <body>This is a sample title named <B>Samle Title</B> </body> </html>[/B]
------------------------------ I have tried it using in many ways but somehow it's not working at my end. I tried using <xsl:for-each select="Item"> <xsl:template match="B"> <xsl:copy> <xsl:apply-templates"/> </xsl:copy> </xsl:template> and then <xsl:choose> <xsl:when test="contains(@Type, 'Paragraph')">