[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Using XSL to create HTML page from values of attributes
I don't work with IE 5.0 for XSL. However, the problem is that you are outputting <H1> and </H1> as part of a text node. You might try including disable-output-escaping="yes" on your xsl:value-of elements so that they look like this: <xsl:value-of select="//Name/@NameBeginTag" disable-output-escaping="yes" /> This works for me with a W3C parser (xalan). The basic problem here is that you are assembling a text node which you may really want to look like an element node with a child text node. This might work better for you. It eliminates the < > stuff as well and ensures that the end tag matches the beginning tag: example.xml <?xml version="1.0"?> <?xml-stylesheet href="example.xsl" type="text/xsl"?> <Name id="3270" NameBeginTag="H1"> <Child>Joe</Child> <Child>Pete</Child> </Name> example.xsl <?xml version="1.0"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl"> <xsl:template match="/"> <HTML> <head> </head> <BODY> <xsl:for-each select="Name/Child"> <xsl:element name="{//Name/@NameBeginTag}"> <xsl:value-of select="."/> </xsl:element> </xsl:for-each> </BODY> </HTML> </xsl:template> </xsl:stylesheet> HTH, Gary Badarinath_Kopparapu@xxxxxxxx wrote: > > Hi > > I am using IE 5.0 as my XSL processor. > > I have a scenario where I have to use XSL to generate an HTML page using the > content and the HTML tags specified in an XML document. > Basically, the content and how to display the content, (for eg, bold or > italicized or <H1> </H1> or <H4> </H4>) are present in the XML document as > eithe nodes or attributes. Let me give you an example: > > example.xml > <?xml version="1.0"?> > <?xml-stylesheet href="example.xsl" type="text/xsl"?> > <Name id="3270" > NameBeginTag="<H1>" > NameEndTag="</H1>"> > <Child>Joe</Child> > <Child>Pete</Child> > </Name> > > example.xsl > <?xml version="1.0"?> > <xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl"> > <xsl:template match="/"> > <HTML> > <head> > </head> > <BODY> > <xsl:for-each select="Name/Child"> > <xsl:value-of select="//Name/@NameBeginTag"/> > <xsl:value-of select="."/> > <xsl:value-of select="//Name/@NameEndTag"/> > </xsl:for-each> > </BODY> > </HTML> > </xsl:template> > </xsl:stylesheet> > > This xsl results in a page that looks like this in the browser. Basically the > tags are printed literally on the HTML page.. > > "<H1> Joe </H1> <H1> Pete </H1> " > > I understand what is happening, since the NameBeginTag attribute in the Name > node has the tags literally (<.... >....), the xsl also prints it > literally.. > Could someone please tell me how I can work around this ? In my XML document I > canNOT put the tags <H1> </H1> in the node attributes, as neither > attributes nor nodes can contain < , > symbols. > > Later.. > Badari XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|