![]() |
![]() | ![]() | ![]() | Altova Mailing List Archives>Archive Index >microsoft.public.xsl Archive Home >Recent entries >Thread Prev - Re: Convert attributes to elements and lower case >Thread Next - Re: Convert attributes to elements and lower case Re: Convert attributes to elements and lower caseTo: NULL Date: 9/11/2007 6:40:00 PM
> Replace <xsl:value-of select="." /> with:-
>
> <xsl:choose>
> <xsl:when test=". = 'True'"><xsl:text>true</xsl:text></xsl:when>
> <xsl:when text=". = 'False'"><xsl:text>false</xsl:text></xsl:when>
> <xsl:otherwise><xsl:value-of select="." /></xsl:otherwise>
> </xsl:choose>
>
>
I'd go for:
<xsl:choose>
<xsl:when test=". = 'True' or . = 'False' "><xsl:value-of select=". =
'True' "/></xsl:when>
<xsl:otherwise><xsl:value-of select="." /></xsl:otherwise>
</xsl:choose>
Just one <xsl:when/> shorter :o)
Cheers,
Dimitre Novatchev
"Anthony Jones" <Ant@y...> wrote in message
news:%23qTS0GH8HHA.396@T......
> <sog2k7@g...> wrote in message
> news:1189011666.431390.68010@5......
>> I have an XML document where, for each node, I want to convert all the
>> attributes of the node to elements. Also, whenever I have a value of
>> "True" or "False" for an attribute, I want to convert it to lower case
>> ("true", "false").
>>
>> This XSLT fragment will convert attributes to elements:
>>
>> <xsl:template match="/Lenders/LenderEntry">
>> <LenderEntry xmlns="http://tempuri.org/SecuredLoansDataSet.xsd">
>>
>> <xsl:for-each select="@*">
>> <xsl:element name="{name()}">
>> <xsl:value-of select="."/>
>> </xsl:element>
>> </xsl:for-each>
>>
>> </LenderEntry>
>> </xsl:template>
>>
>> Any ideas on how to convert boolean strings to lower case?
>>
>> Like...
>>
>> if attribute value == "True" write "true"
>> if attribute value == "False" write "false"
>>
>
> Replace <xsl:value-of select="." /> with:-
>
> <xsl:choose>
> <xsl:when test=". = 'True'"><xsl:text>true</xsl:text></xsl:when>
> <xsl:when text=". = 'False'"><xsl:text>false</xsl:text></xsl:when>
> <xsl:otherwise><xsl:value-of select="." /></xsl:otherwise>
> </xsl:choose>
>
>
> --
> Anthony Jones - MVP ASP/ASP.NET
>
>
| ![]() | ![]() | ![]() |
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | |||
|
