[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: Problem with xsl file
Bikash, The problem is you are using <xsl:attribute> without creating the <font> tag - you can only use <xsl:attribute> *after* you create the tag you want to use it with. Also, you generally only need to use <xsl:attribute> if the values are dynamic. So, the following two are identical, but the second one is much easier: 1. <font> <xsl:attribute name="size"> <xsl:value-of select="@size1"/> </xsl:attribute> <xsl:value-of select="."/> </font> 2. <font size="{@size1}"> <xsl:value-of select="."/> </font> Please not that the {@attribute-name} syntax can only be used inside the "" of an attribute value. It is simply a shorthand for saying <xsl:value-of select="@attribute-name"/> Try this: ------------------------------------ <?xml version="1.0"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl"> <xsl:template match="/"> <xsl:apply-templates/> </xsl:template> <xsl:template match="root"> <xsl:apply-templates/> </xsl:template> <xsl:template match="para"> <xsl:for-each select="style"> <font size="{@size1}" color="{@color}" face="{@face1}"> <xsl:value-of select="."/> </font> </xsl:for-each> </xsl:template> </xsl:stylesheet> ----------------------------------- Hope this helps... William Bagby. -----Original Message----- From: Bikash Paul [mailto:bikashpaul_2001@xxxxxxxxx] Sent: Monday, October 01, 2001 1:10 AM To: XSL-List-Digest@xxxxxxxxxxxxxxxxxxxxxx Subject: Problem with xsl file Dear sir, I have problem with my xsl file.I want to extract value of tag and style them with their corroesponding attribute value.My xsl working for extracting value of tag and style them with one attribute that means with size only it mix the color with previous(that is when i set color="blue" then it mix with the default color "black" and it shown brown color on browser)and font face totally not working.I couldn't understand where I done a mistake.Can u plz guide me how I can slove my problem.Below r my codes. xml file:- <?xml version="1.0"?> <?xml-stylesheet type="text/xsl" href="ebook1.xsl"?> <root> <para><style size1="7" color1="blue" face1="Arial">This is only for test</style></para> </root> xsl file:- <?xml version="1.0"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/TR/WD-xsl"> <xsl:template match="/"> <xsl:apply-templates/> </xsl:template> <xsl:template match="root"> <xsl:apply-templates/> </xsl:template> <xsl:template match="para"> <xsl:for-each select="style"> <xsl:attribute name="color"> <xsl:value-of select="@color1"/> </xsl:attribute> <xsl:attribute name="size"> <xsl:value-of select="@size1"/> </xsl:attribute> <xsl:attribute name="face"> <xsl:value-of select="@face1"/> </xsl:attribute> <xsl:value-of select="."/> </xsl:for-each> </xsl:template> </xsl:stylesheet> Regards Bikash Paul __________________________________________________ Do You Yahoo!? Listen to your Yahoo! Mail messages from any phone. http://phone.yahoo.com XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
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
|