xsl-list
[Top] [All Lists]

RE:RE: [xsl] HELP : XSLT Merge XML Files and Mixing

2005-03-16 07:15:26
Mike

Thanx for the tip, I was doing it wrong. I changed 
the XML to 

 XML
 --------------
    <sports>
    <name>sports</name>
    <title>Sports Channel</title>
    </sports>
    <golf>
    <name>golf</name>
    <title>Golf Channel</title>
    </golf>


and it worked. 

But I have a follow-up question, in case my XML is
structured as earlier

 XML
 --------------
    <channel>
    <name>sports</name>
    <title>Sports Channel</title>
    </channel>
    <channel>
    <name>golf</name>
    <title>Golf Channel</title>
    </channel>


How can I select the Channel with a Attribute
Name:Sports and select the Title using XSL

<channel>
     <title><xsl:value-of select="$ochannels//*[name()
 = $channel]/name"/></title>
 </channel>


Basically, I am trying to select the Channel Title
based on a parameter I pass to the XSL

Thanx again
Rajesh. 

Date: Tue, 15 Mar 2005 22:22:44 -0000
To: <xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com>
From: "Michael Kay" <mike(_at_)saxonica(_dot_)com>
Subject: RE: [xsl] HELP : XSLT Merge XML Files and
Mixing 
Params/Variables

You don't have an element in your document called
<sports>, let alone a
<sports> element with a child called <name>.

What output did you expect?

Michael Kay
http://www.saxonica.com/ 

-----Original Message-----
From: Rajesh Jain [mailto:rjain15(_at_)yahoo(_dot_)com] 
Sent: 15 March 2005 21:32
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Cc: Rajesh Jain
Subject: [xsl] HELP : XSLT Merge XML Files and
Mixing 
Params/Variables

Hi

I am merging two XML files and using parameters to
merge, but this doesn't work. I don't know what I am
missing......


Parameter in Java
------------------
              transformer.setParameter("channel","sports");

XML
--------------
   <channel>
   <name>sports</name>
   <title>Sports Channel</title>
   </channel>
   <channel>
   <name>golf</name>
   <title>Golf Channel</title>
   </channel>

XSL :
---------------------------
<xsl:param name="channel" />
<xsl:variable name="ochannels"
select="document('ochannels.xml')"/>

<channel>
    <title><xsl:value-of
select="$ochannels//*[name()
= $channel]/name"/></title>
</channel>

Output XML
----------
<channel><title/></channel>

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



Please help!!!!
Thanx
Rajesh




--~------------------------------------------------------------------
XSL-List info and archive: 
http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to:
http://lists.mulberrytech.com/xsl-list/
or e-mail:
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



<Prev in Thread] Current Thread [Next in Thread>
  • RE:RE: [xsl] HELP : XSLT Merge XML Files and Mixing, Rajesh Jain <=