[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Attribute and Element Formatting Issues
Hi,
Tempore 16:08:57, die 09/13/2005 AD, hinc in xsl-list@xxxxxxxxxxxxxxxxxxxxxx scripsit Mehta, Chirag <chirag.mehta@xxxxxxxxxxxxxxxxx>: <?xml version="1.0" encoding="utf-8"?> <portfolio name="CBOT" version="1"> <trade name="Future" quantity="1"> <instrument instType="Bond"> <dictionary> <dict name="expiry date" type="t"> </dict>
<xsl:template match="node()|@*"> <xsl:copy> <xsl:apply-templates select="node()|@*" /> </xsl:copy> </xsl:template> <xsl:template match="dictionary"><xsl:apply-templates/></xsl:template> <xsl:template match="dict"> <xsl:variable name="new_name"> <xsl:call-template name="capitalize"> <xsl:with-param name="string" select="@name"/> </xsl:call-template> </xsl:variable> <xsl:element name="{$new_name}"><xsl:apply-templates/></xsl:element> </xsl:template> <xsl:template name="capitalize"> <xsl:param name="string"/> <xsl:param name="caps" select="false()"/> <xsl:if test="contains($string,' ')"> <xsl:if test="$caps"> <xsl:value-of select="translate(substring(substring-before($string,' '),1,1),'abcdefghijklmnopqrstuvwxyz','ABCDEFGHIJKLMNOPQRSTUVWXYZ')"/> <xsl:value-of select="substring(substring-before($string,' '),2)"/> </xsl:if> <xsl:if test="not($caps)"> <xsl:value-of select="substring-before($string,' ')"/> </xsl:if> <xsl:call-template name="capitalize"> <xsl:with-param name="string" select="substring-after($string,' ')"/> <xsl:with-param name="caps" select="true()"/> </xsl:call-template> </xsl:if> <xsl:if test="not(contains($string,' '))"> <xsl:if test="$caps"> <xsl:value-of select="translate(substring($string,1,1),'abcdefghijklmnopqrstuvwxyz','ABCDEFGHIJKLMNOPQRSTUVWXYZ')"/> <xsl:value-of select="substring($string,2)"/> </xsl:if> <xsl:if test="not($caps)"> <xsl:value-of select="$string"/> </xsl:if> </xsl:if> </xsl:template> </xsl:stylesheet>
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|