Jump to content

XSLT


TolReb

Recommended Posts

Can I use XSLT statements inside XML document? As CSS?And How I must write it?My be:<?xml version="1.0" encoding="windows-1251"?><?xml-stylesheet type = "text/xsl" href = "#bill"?><rootElement><someElements></someElements>some XML Elements<xsl:stylesheet id="bill" style="display:none" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> Some XSL templates...</xsl:stylesheet></rootElement>

Link to comment
Share on other sites

You've got it right. It's exactly like that... except you don't need the style attribute (which would make the XSLT invalid anyway).You don't need it as the stylesheet will automatically be hidden when the XML is displayed in the browser. Browsers show only the outputs of transformations, not the XML or XSLT of it.To put a raw sample out:

<?xml version="1.0" encoding="windows-1251"?><?xml-stylesheet type = "text/xsl" href = "#bill"?><rootElement><someElements>some text</someElements>some XML Elements<xsl:stylesheet id="bill" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:template match="/"><xsl:value-of select="."/></xsl:stylesheet></rootElement>

Link to comment
Share on other sites

Unfortunately it doesn’t work!Opera 9.01 says: “XSLT processing failed!”IE 6.0 can’t get data from XML content.Mozilla Firefox 1.5 doesn’t do anything.Can I do it work? I changed stylesheet and XML content by order, but... :)(My example is below:<?xml version="1.0"?><?xml-stylesheet type = "text/xsl" href = "#bill"?><bill> <xsl:stylesheet id="bill" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:template match="/"> <html> <head> <title><xsl:value-of select="/bill/billno"/></title> </head> <body> <p>It must work!?</p> <p><b><xsl:value-of select="/bill/billno"/></b></p> </body> </html> </xsl:template> <xsl:template match="bill/billno"> <b><xsl:value-of select="."/></b> </xsl:template> </xsl:stylesheet> <billno>123/45</billno></bill>

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...