Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: Convert attributes to elements and lower case

From: "Dimitre Novatchev" <dimitren@---.---.-->
To: 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
>
> 




transparent
Print
Mail
Digg
delicious
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent