Q:

FlowDocument to HTML transformation - how do I select the foreground color in XSLT?

I have adapted and extended the XSLT from this answer into this:
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet
    version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:msxsl="urn:schemas-microsoft-com:xslt"
    exclude-result-prefixes="msxsl x">

  <xsl:output method="xml" indent="yes" omit-xml-declaration="yes"/>

  <xsl:template match="x:Section[not(parent::x:Section)]">
    <div>
      <xsl:apply-templates select="node()"/>
    </div>
  </xsl:template>

  <xsl:template match="x:Section">
    <xsl:apply-templates select="node()"/>
  </xsl:template>

  <xsl:template match="x:Paragraph">
    <p>
      <xsl:apply-templates select="node()"/>
    </p>
  </xsl:template>

  <xsl:template match="x:Run">
    <xsl:variable name="style">
      <xsl:if test="@FontStyle='Italic'">
        <xsl:text>font-style:italic;</xsl:text>
      </xsl:if>
      <xsl:if test="@FontWeight='Bold'">
        <xsl:text>font-weight:bold;</xsl:text>
      </xsl:if>
      <xsl:if test="contains(@TextDecorations, 'Underline')">
        <xsl:text>text-decoration:underline;</xsl:text>
      </xsl:if>
      <xsl:if test="@FontSize != ''">
        <xsl:text>font-size:</xsl:text>
        <xsl:value-of select="@FontSize" />
        <xsl:text>pt;</xsl:text>
      </xsl:if>
      <xsl:if test="@FontFamily != ''">
        <xsl:text>font-family:</xsl:text>
        <xsl:value-of select="@FontFamily" />
        <xsl:text>;</xsl:text>
      </xsl:if>
      <xsl:if test="@Foreground-Color != ''">
        <xsl:text>color:</xsl:text>
        <xsl:value-of select="@Foreground-Color"/>
        <xsl:text>;</xsl:text>
      </xsl:if>
    </xsl:variable>
    <span>
      <xsl:if test="normalize-space($style) != ''">
        <xsl:attribute name="style">
          <xsl:value-of select="normalize-space($style)"/>
        </xsl:attribute>
      </xsl:if>
      <xsl:value-of select="text()"/>
    </span>
  </xsl:template>
</xsl:stylesheet>

This XSLT works perfectly, except for this part:
  <xsl:if test="@Foreground-Color != ''">
    <xsl:text>color:</xsl:text>
    <xsl:value-of select="@Foreground-Color"/>
    <xsl:text>;</xsl:text>
  </xsl:if>

Apart from Foreground-Color, I have tried Color and FontColor, but nothing seems to work. 
What is the correct keyword after "test=" and "select=" to extract the text foreground color?

A:

It is more a CSS problem than an XSLT problem as you create HTML with CSS inline styles. The correct property name in CSS is indeed color so that part is correct. I don't know however which color values your input format uses and whether they are equal to the color names CSS understands. So show us a sample of the input and check the CSS color property value spec: http://www.w3.org/TR/CSS2/syndata.html#value-def-color. 
As for the attribute, based on http://msdn.microsoft.com/en-us/library/system.windows.documents.textelement.foreground.aspx the attribute might simply be
  <xsl:if test="@Foreground != ''">
    <xsl:text>color:</xsl:text>
    <xsl:value-of select="@Foreground"/>
    <xsl:text>;</xsl:text>
  </xsl:if>

I haven't checked the possible color values and their match with CSS values.

