Skip to content

Conditional TSS treats floating point zero as blank #218

@cj-clx

Description

@cj-clx

It would be nice if the following worked as expect, displaying the value $0.00 instead of leaving the XML unaltered.

<?php
require "vendor/autoload.php";

$xml = '<span>FAILS</span>';

$tss = 'span:[data(foo)!=""]  { content: "$", data(foo); } ';

$data['foo'] = 0.00;

$template = new Transphporm\Builder($xml, $tss);
echo $template->output($data)->body . PHP_EOL;

I have frequent need for this kind of check in my TSS code because the application service classes I'm calling don't always return every data element.

Is there perhaps a work-around I don't know about?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions