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

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

Subject: Re: Probelm with xsl:value-of in CSV to XML transform
From: David Carlisle <davidc@xxxxxxxxx>
Date: Fri, 4 Apr 2008 02:45:08 +0100
Re:  Probelm with xsl:value-of in CSV to XML transform
<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. 
________________________________________________________________________

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.