[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

how to display text and links on the order they appear

Subject: how to display text and links on the order they appear using xsl:templates
From: "Pasupathi, Selvakumar" <swp4@xxxxxxx>
Date: Fri, 13 Jun 2003 11:13:56 -0400
xsl display text
Hi all,

 

Xml file

-------------

<?xml version="1.0" encoding="UTF-8"?>

<emc>

            <roottopic roottopicname="Engineering">

                        <content>

                                    <id>37</id>

                                                <questions>

                                                <text> ssss</text>

                                                </questions>

                                                <answers>

                                                            <text>I am the
answer text</text>

                                                            <links
linktext="1. Back Burner" href="http://www.cdc.gov"/>

            <text> 2 answertext</text>

                        <links linktext="2. Back Burner"
href="http://www.cdc.gov"/>

                        <text>answer text  continuess..........</text>

</answers> 

            </content>

            <content>

            <id>57</id>

            <questions><text> what is the  II            question?</text>

                                                </questions>

 <answers>

                                                <text>This is 3 answer
text</text>

                                                <links linktext=" 3.Back
Burner"  href="http://www.cdc.gov"/>

 

            <text>This is 4 answer text</text>

                                                <links linktext="4. Back
Burner"  href="http://www.cdc.gov"/>

 

</answers> 

            </content>

            </roottopic>

            

            <roottopic roottopicname="Purchase">

                                    <content>

                                                <id>17</id>

                                                            <questions>

                                                            <text>
ssss</text>

                                                            </questions>

                                                            <answers>

 
<text>I am the 1  answer text</text>

 
<links linktext="1. Back Burner" href="http://www.cdc.gov"/>

                        <text> 2 answertext continues.........</text>

                                    <links linktext="2. Back Burner"
href="http://www.cdc.gov"/>

            </answers> 

                        </content>

                        <content>

                        <id>47</id>

                        <questions><text> what is the  II
question?</text>

                                                            </questions>

             <answers>

                                                            <text>This is 3
answer text</text>

                                                            <links
linktext=" 3.Back Burner"  href="http://www.cdc.gov"/>

            

                        <text>This is 4 answer text</text>

                                                            <links
linktext="4. Back Burner"  href="http://www.cdc.gov"/>

            

            </answers> 

                        </content>

            </roottopic>

</emc>

 

 

xsl File

-----------

<?xml version="1.0" encoding="UTF-8"?>

<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:fo="http://www.w3.org/1999/XSL/Format">

<xsl:template match="/">

 

<html>

<body>

<xsl:for-each select="emc/roottopic">

<xsl:apply-templates select="content"/>

            </xsl:for-each></body>

</html>

</xsl:template>

<xsl:template match="content">

 

<xsl:apply-templates select="questions"/>

<xsl:apply-templates select="answers"/>

</xsl:template>

 

<xsl:template match="questions">

<xsl:apply-templates select="text"/>

<xsl:apply-templates select="links"/> 

</xsl:template>

 

<xsl:template match="answers">

 

 <xsl:apply-templates select="text"/>

<xsl:apply-templates select="links"/>

 

</xsl:template>

<xsl:template match="text">

 

<p>

<h2><xsl:value-of select="."/></h2>

</p>

 

<br></br>

 

</xsl:template>

 

<xsl:template match="links">

<xsl:variable name="hrefvalue">

<xsl:value-of select="@href"/></xsl:variable>

<a href="{$hrefvalue}">

<xsl:value-of select="@linktext"/></a>

 

</xsl:template>

 

</xsl:stylesheet>

 

 

On the above xml how can i get the values of text and links elements inside
the questions and answers tags

on the order they appear on xml. Right now my xsl looks like this and it
gets all the text element values as a collection and links value as a
collection. Any help would be greatly appreciated.

 

Thanks,

selva

 


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.