www.webdeveloper.com
Results 1 to 2 of 2

Thread: Specifying which stylesheet to use

  1. #1
    Join Date
    Apr 2003
    Location
    UK
    Posts
    41

    Specifying which stylesheet to use

    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>

  2. #2
    Join Date
    Dec 2002
    Location
    Calgary, Canada
    Posts
    6,123
    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
    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..
    Cheers

    Khalid

    Message Posting Guidelines In These Forums, Please read these before posting any question.
    Web site: webapplikations.com
    Web Resources Page:Web Resources

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles