Specifying which stylesheet to use

admin

Administrator
Staff member
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>
 
Back
Top