Re: RE: [xsl] Basic help needed.

Subject: Re: RE: [xsl] Basic help needed.
From: kaseykim@xxxxxxxxxxxx
Date: Thu, 30 Oct 2003 01:21:08 -0800
Michael
Thank you for your response.
I followed your advice and changed the code like the 
followings, and 
I still do not get the parameter passed from the PROJECT 
template to EXPERIMENT template.
Do I have any wrong syntax, or am I misunderstanding ?
Your help is most appreciated. I am desperate.
Kasey in LA


<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>

<xsl:template match="PROJECT">
INSERT INTO PROJECT <xsl:value-of select="@PID"/>,
<xsl:value-of select="TITLE"/>,
<xsl:value-of select="START_DATE"/>,

<xsl:apply-templates select="EXPERIMENT">
<xsl:with-param name="my_pid" select="@PID" />
</xsl:apply-templates>

</xsl:template>



<xsl:template name="experiment" match="EXPERIMENT">
<xsl:param name="my_pid" />
INSERT INTO EXPERIMENT <xsl:value-of select="@EXPID"/>,
<xsl:value-of select="TITLE"/>,
<xsl:value-of select="START_DATE"/>,
<xsl:value-of select="END_DATE"/>,
<xsl:value-of select="$my_pid"/>;
</xsl:template>

</xsl:stylesheet>





----- Original Message -----
From: Michael Kay <mhk@xxxxxxxxx>
Date: Thursday, October 30, 2003 0:50 am
Subject: RE: [xsl] Basic help needed.

> This code:
> 
> <xsl:for-each select="EXPERIMENT">
> <xsl:apply-templates>
> <xsl:with-param name="my_pid" select="@PID" />
> </xsl:apply-templates>
> </xsl:for-each>
> 
> is applying templates to the children of the EXPERIMENT 
element, 
> not to
> the EXPERIMENT itself. The default for apply-templates is
> select="child::node()", not select=".". Change it to:
> 
> <xsl:apply-templates select="EXPERIMENT">
> <xsl:with-param name="my_pid" select="@PID" />
> </xsl:apply-templates>
> 
> Michael Kay
> 
> 
> > -----Original Message-----
> > From: owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx 
> > [owner-xsl-list@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of 
> > kaseykim@xxxxxxxxxxxx
> > Sent: 30 October 2003 07:02
> > To: XSL-List@xxxxxxxxxxxxxxxxxxxxxx
> > Subject: [xsl] Basic help needed.
> > 
> > 
> > Guys
> > I would really appreciate if you can help me, why, in the 
> > following XSL code, the paramter is not being passed 
from the 
> > parent node for the child node. I read through every 
tutorial 
> > and I could not yet figure out why it does not work.
> > 
> > In other words, the template "experiment" does not get 
the 
> > "my_pid" from the root body.
> > 
> > Kasey in LA.
> > 
> > 
----------------------------------------------------
---
> > 
> > <?xml version="1.0" encoding="ISO-8859-1"?>
> > <xsl:stylesheet version="1.0"
> > xmlns:xsl="http://www.w3.org/1999/XSL/Transform";>
> >       
> > <xsl:template match="PROJECT">
> > INSERT INTO PROJECT <xsl:value-of select="@PID"/>,
> > <xsl:value-of select="TITLE"/>,
> > <xsl:value-of select="START_DATE"/>,
> > <xsl:value-of select="END_DATE"/>,
> > <xsl:value-of select="CREATION_DATE"/>;
> >  
> > <xsl:for-each select="EXPERIMENT">
> > <xsl:apply-templates>
> > <xsl:with-param name="my_pid" select="@PID" />
> > </xsl:apply-templates>
> > </xsl:for-each>
> >  
> > </xsl:template>
> >  
> >  
> >  
> > <xsl:template name="experiment" 
match="EXPERIMENT">
> > <xsl:param name="my_pid" />
> > INSERT INTO EXPERIMENT <xsl:value-of select="@EXPID"/
>,
> > <xsl:value-of select="TITLE"/>,
> > <xsl:value-of select="START_DATE"/>,
> > <xsl:value-of select="END_DATE"/>,
> > <xsl:value-of select="ORG_NAME"/>,
> > <xsl:value-of select="ORG_ADDRESS"/>,
> > <xsl:value-of select="LOCATION"/>,
> > <xsl:value-of select="$my_pid"/>;
> > </xsl:template>
> >       
> > </xsl:stylesheet>
> > 
> > 
> > 
> > 
> > 
> >  XSL-List info and archive:  http://
www.mulberrytech.com/xsl/xsl-
> list> 
> 
> 
> XSL-List info and archive:  http://www.mulberrytech.com/
xsl/xsl-list
> 
> 


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


Current Thread