|
Subject: [xsl] RE:RE: [xsl] HELP : XSLT Merge XML Files and Mixing From: Rajesh Jain <rjain15@xxxxxxxxx> Date: Wed, 16 Mar 2005 06:15:26 -0800 (PST) |
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@xxxxxxxxxxxxxxxxxxxxxx>
From: "Michael Kay" <mike@xxxxxxxxxxxx>
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@xxxxxxxxx]
> Sent: 15 March 2005 21:32
> To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
> 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
| Current Thread |
|---|
|
| <- Previous | Index | Next -> |
|---|---|---|
| [xsl] Pagination with query and sor, Jason Trépanier | Thread | [xsl] About Michael Kay's XSLT book, Midsummer Sun |
| [xsl] Pagination with query and sor, Jason Trépanier | Date | RE: [xsl] external var in XSL, Michael Kay |
| Month |