Link to home
Start Free TrialLog in
Avatar of magento
magento

asked on

Filemaker xsl file

Hi,

I am having a xml , which is a simple table . I just need to make the first column bold and header in yellow color .

Please help me provide a xsl file for it.

Thanks
test.xml
Avatar of zc2
zc2
Flag of United States of America image

So, do you need an XSLT which converts the data XML to HTML?
Since I did not get an answer to my question, I assumed you need an HTML output.
I made a simple XSLT which creates an HTML table from your input XML:

<?xml version="1.0"?>
<xsl:stylesheet version="1.0" 
	xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
	xmlns:f="http://www.filemaker.com/fmpxmlresult">
<xsl:output method="html" encoding="iso-8859-1"/>

<xsl:template match="/">
  	<xsl:apply-templates select="f:FMPXMLRESULT/f:RESULTSET/f:ROW"/>
</xsl:template>

<xsl:template match="f:ROW">
  <table border="1">
  	<xsl:apply-templates select="f:COL"/>
  </table>
</xsl:template>
	
<xsl:template match="f:COL">
  <tr>
	<xsl:if test="position() = 1">
		<xsl:attribute name="style">background-color: yellow;</xsl:attribute>
	</xsl:if>
    <xsl:apply-templates select="f:DATA"/>
  </tr>
</xsl:template>	
	
<xsl:template match="f:DATA">
	<td>
		<xsl:if test="position() = 1">
			<xsl:attribute name="style">font-weight: bold;</xsl:attribute>
  		</xsl:if>
		<xsl:value-of select="."/>
		<xsl:if test="string-length(normalize-space(.)) = 0">&#xA0;</xsl:if>
	</td>
</xsl:template>	
	
</xsl:stylesheet>

Open in new window

Avatar of magento
magento

ASKER

Hi,
yes this is what i am looking for , i will test it and let you know.

Thanks
Avatar of magento

ASKER

Hi ,

I am getting the output in different manner.
I want them to show like  below.

NAME              VALUE
Retail Price       100
Item Class         25486

But i am getting the html table in horizontal way. Please find the result i have got.

<table xmlns:f="http://www.filemaker.com/fmpxmlresult" border="1">
<tr style="background-color: yellow;">
<td style="font-weight: bold;">Retail Price</td><td>Item Class</td><td>Item Group</td><td>Consumer Description</td><td>Color</td><td>Item Code</td><td>Catalog Vendor Name</td><td>Item Status</td><td>Wildcat Eligible</td><td>Item Description</td><td>Primary Vendor</td><td>InventoryTyp</td><td>ProductPageNumber</td><td>Vendor Group</td>
</tr>
<tr>
<td style="font-weight: bold;">234.99</td><td>13034</td><td>13</td><td>BlackGorge Expandable Convertible Pack System With Hydration Pocket Mossy Oak Break Up Camouflage</td><td>Mossy Oak Break-Up</td><td>73CP00M1</td><td>BLACKHAWK!</td><td>OPEN</td><td>Y</td><td>BHP BLACKGORGE EXPAND MOBU</td><td>58895</td><td>MDS</td><td>&nbsp;</td><td>BHP</td>
</tr>
</table>

Open in new window


Thanks,
ASKER CERTIFIED SOLUTION
Avatar of zc2
zc2
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of magento

ASKER

This works great , thank you.
You're welcome