Trying CSS in XPP 9.3

Hi everyone:

I'm playing around with CSS in XPP 9.3. I am trying to recreate one of the examples in the book (See CSS.pdf, pages 4-14 - 4-15). The only thing I'm doing different is I'm trying to use the attr() function to pass along the value of the color attribute in my XML (<Para color="red">This is a para.</Para>).
My CSS has this line: Para[color]:before{ content: -xpp-perl(start_box, "attr(color)");}, and the perl function looks like this:
sub start_box {
$color = @_;
$X->set_text("Color is: $color");
$X->sfboxt("50", "$color");
I added the 'set_text' line to see what the value of the variable is, but it always comes back as 1, regardless of the color, so my boxed text is always grey. I've tried using a number instead of the color name, but get the same result. It seems to be returning the position of the attribute, and not the value. What am I doing wrong here?
Bart, I have your perl handout from the 2015 Conference, but it's a bit out of date now, since versions of XPP have changed a bit.
Thank you!!

Parents Reply Children
No Data