Re: [xsl] Probelm with xsl:value-of in CSV to XML transform

Subject: Re: [xsl] Probelm with xsl:value-of in CSV to XML transform
From: Marney Cotterill <marney@xxxxxxxxxxxxxxxxxxxx>
Date: Fri, 04 Apr 2008 12:58:52 +1100
Thank you so much for the quick response!

You are a life saver! I will implement now and hopefully no more problems!!!

Thanks again David!
Marney


On 4/4/08 12:45 PM, "David Carlisle" <davidc@xxxxxxxxx> wrote:

> 
> 
> <xsl:when test="name()='classdate'">
> 
> 
> don't do that (name() isn not namespace aware and is probably slow)
> 
> do
> 
> <xsl:when test="self::classdate">
> 
> 
> but if you have a template consisting of a xsl:choose like this it's
> usually better to change to to be
> 
> match="classdate"
> 
> 
>                 <xsl:element name="classdate">
> 
> or more simply <classdate> you only need xsl:eleemnt if you calculate
> the element name dynamically.
> 
> 
>                           <xsl:value-of select="sortdate"/>
> 
> 
> sortdate is your sister not your child,
> 
>                           <xsl:value-of
> select="preceding-sibling::sortdate[1]"/>
> 
> <xsl:value-of select="sortdate"/>, this resulted in <value/>
> you selected no children of this name
> 
> <xsl:value-of select="name()='sortdate'"/>, this resulted in
> <value>false</value>
> that isn't the name() evaluates to classdate here and thse strings are
> not equal
> 
> 
> <xsl:value-of select="/root/row/sortdate"/>, this placed all instances of the
> whih is what you selected (in xslt 1 you'd just get the value of teh
> first one)
> 
> 
> 
> ah you have whol esheet
> 
>           <xsl:for-each select="node()">
>             <xsl:choose>
> 
> 
> yes don't do that that is just implementing template application by
> hand, just do
> <xsl;apply-templates/>
> 
> and replace each when clause by a template
> 
> so 
> 
>               <xsl:template match="daytime[.='yes']'">
>                     <xsl:copy>
>                       <items>
>                         <item>
>                           <label>yes</label>
>                           <value>**DAYTIME CLASS**</value>
>                         </item>
>                       </items>
>                     </xsl:copy>
>               </xsl:template>
> 
> etc
> 
> 
> 
>> disable-output-escaping="yes">]]&gt;</xsl:text>
> d-o-e is evil, espeecially doing what youu have there as if there are
> any < or & in your strings the CDATA section will corrupt the output
> (and if there are not, it does nothing)
> 
> 
> David
> 
> ________________________________________________________________________
> The Numerical Algorithms Group Ltd is a company registered in England
> and Wales with company number 1249803. The registered office is:
> Wilkinson House, Jordan Hill Road, Oxford OX2 8DR, United Kingdom.
> 
> This e-mail has been scanned for all viruses by Star. The service is
> powered by MessageLabs.
> ________________________________________________________________________
> 
> 

Marney Cotterill
graphic designer
                   
cracker//brandware

6 Bourke Street
Queens Park 
NSW 2022
Telephone 02 9387 2001
Facsimile 02 9387 2006
marney@xxxxxxxxxxxxxxxxxxxx
www.crackerbrandware.com

Current Thread