XSL - Modify XML Export to Excel to add Bold Style Dynamically -


i'm trying modify xml file using xsl file create excel spreadsheet - i've got basics of working need customise bit. 6th column in xml file contains 1 records , modify output apply bold style rows flagbold field/6th col equals 1.

here's current xml:

<?xml version="1.0" encoding="utf-8"?> <fmpxmlresult xmlns="http://www.filemaker.com/fmpxmlresult">     <errorcode>0</errorcode>     <product build="06-06-2017" name="filemaker" version="proadvanced 16.0.2"/>     <metadata>         <field emptyok="yes" maxrepeat="1" name="columna" type="text"/>         <field emptyok="yes" maxrepeat="1" name="columnb" type="text"/>         <field emptyok="yes" maxrepeat="1" name="columnc" type="text"/>         <field emptyok="yes" maxrepeat="1" name="columnd" type="text"/>         <field emptyok="yes" maxrepeat="1" name="columne" type="text"/>         <field emptyok="yes" maxrepeat="1" name="flagbold" type="text"/>     </metadata>     <resultset found="6">         <row modid="0" recordid="900">             <col>                 <data>created: 15-august-2017</data>             </col>             <col>                 <data/>             </col>             <col>                 <data/>             </col>             <col>                 <data/>             </col>             <col>                 <data/>             </col>             <col>                 <data>1</data>             </col>         </row>         <row modid="0" recordid="901">             <col>                 <data/>             </col>             <col>                 <data/>             </col>             <col>                 <data/>             </col>             <col>                 <data/>             </col>             <col>                 <data/>             </col>             <col>                 <data/>             </col>         </row>         <row modid="1" recordid="902">             <col>                 <data>name</data>             </col>             <col>                 <data>id</data>             </col>             <col>                 <data>category</data>             </col>             <col>                 <data>number</data>             </col>             <col>                 <data>amount</data>             </col>             <col>                 <data>1</data>             </col>         </row>         <row modid="1" recordid="904">             <col>                 <data>acme corp pty ltd</data>             </col>             <col>                 <data>123456</data>             </col>             <col>                 <data>category 1</data>             </col>             <col>                 <data>1</data>             </col>             <col>                 <data>$456.78</data>             </col>             <col>                 <data/>             </col>         </row>         <row modid="1" recordid="905">             <col>                 <data>demo company pty ltd</data>             </col>             <col>                 <data>987654</data>             </col>             <col>                 <data>category 2</data>             </col>             <col>                 <data>1</data>             </col>             <col>                 <data>$789.32</data>             </col>             <col>                 <data/>             </col>         </row>     </resultset> </fmpxmlresult> 

in xsl file have style:

        <style ss:id="mytitlestyle">             <alignment ss:wraptext="0" />             <font  ss:bold="1"/>         </style> 

and i'm processing rows here:

<xsl:for-each select="fmp:fmpxmlresult/fmp:resultset/fmp:row">     <row>         <xsl:for-each select="fmp:col">             <cell>                 <xsl:if test="fmp:col[6]/fmp:data = 1">                     <xsl:attribute name="ss:styleid">mytitlestyle</xsl:attribute>                 </xsl:if>                            <data ss:type="string">                     <xsl:value-of select="." />                 </data>             </cell>         </xsl:for-each><!-- next column -->     </row> </xsl:for-each><!-- next row --> 

but i'm not getting bold style in .xls spreadsheet file created , not sure i'm going wrong here?

the test in:

<xsl:if test="fmp:col[6]/fmp:data = 1"> 

will never return true context of:

<xsl:for-each select="fmp:col"> 

change to:

<xsl:if test="../fmp:col[6]/fmp:data = 1"> 

Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -