Click to See Complete Forum and Search --> : Specifying which stylesheet to use


doodler
07-06-2003, 09:17 PM
Firstly, I'm new to XML and XSL/XSLT and this is my first project. I've got the grasp of how to do it all but I have come across a problem.

My homepage has a news section that has to display one article, being the latest. Another page however, needs to display all articles (including the latest) acting as a kind of history of articles.
My problem is this: the xml file that contains the information and has a link to a XSL file that contains a line of code (<xsl:for-each select="sitenews/item">) which makes each article shown. But I only want the latest article/item shown on my homepage whilst ALL other articles/items shown on the other page!!

What options do I have?
By the way, I am using a script to change my XML data to XHTML:
<script type="text/javascript">
// Load XML
var xml = new ActiveXObject("Microsoft.XMLDOM")
xml.async = false
xml.load("home-services/newsme.xml")

// Load the XSL
var xsl = new ActiveXObject("Microsoft.XMLDOM")
xsl.async = false
xsl.load("home-services/newser.xsl")

// Transform
document.write(xml.transformNode(xsl))
</script>

Khalid Ali
07-07-2003, 12:01 PM
Your approach is limited to IE browser,instead use the XML file and import your xsl file in the xml file that will render in all major browsers:p
With that out of the way..it seems like the question of logic.
You have to find out a conditon that will determine that which report should be displayed..