xsl-list
[Top] [All Lists]

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

2008-04-03 18:45:38


<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. 
________________________________________________________________________

--~------------------------------------------------------------------
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>
--~--