You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-users@xmlgraphics.apache.org by ro...@pfpc.com on 2004/11/24 16:21:52 UTC
Applying multiple styles using span tag problem
Hi
I have a span tag which looks like
<span style="font-family:Times;text-decoration:underline">Thank you for
investing in our services</span>
In my xsl-fo I have templates as
<xsl:template match="html:span[@style='text-decoration:underline']">
<fo:inline text-decoration="underline">
<xsl:apply-templates/>
</fo:inline>
</xsl:template>
<xsl:template match="html:span[@style='font-family: Times; font-size:
12pt']|html:span[@style='font-size:Normalpt']">
<fo:block font-size="12pt" font-family="Times">
<xsl:apply-templates/>
</fo:block>
</xsl:template>
But only one of them is getting applied.I want to know how both the styles
can be applied recursively.
Thanks and Regards
Rohit
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-user-help@xml.apache.org
RE: Applying multiple styles using span tag problem
Posted by "Andreas L. Delmelle" <a_...@pandora.be>.
> -----Original Message-----
> From: Andreas L. Delmelle [mailto:a_l.delmelle@pandora.be]
[Slight adjustment + addition:]
>
> <xsl:template match="span">
> <fo:block>
> <xsl:apply-templates select="@style" />
> </fo:block>
> </xsl:template>
>
You can create an fo:block or an fo:inline here, depending on whether the
span has any span ancestors, or better even, create a separate matching
template for it.
> <xsl:template match="@style">
> <xsl:param name="prop-string" select="." />
And to make this latter template a bit more generic --and to add a level of
control over the generated property names/values--, you could provide a
mapping of some sort in a separate XML or in a different namespace in the
stylesheet...
Greetz,
Andreas
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-user-help@xml.apache.org
RE: Applying multiple styles using span tag problem
Posted by "Andreas L. Delmelle" <a_...@pandora.be>.
> -----Original Message-----
> From: rohit.rastogi@pfpc.com [mailto:rohit.rastogi@pfpc.com]
Hi,
First of all, it may be worth mentioning that this question is actually
better suited for an XSLT-related list.
Furtermore...
> I have a span tag which looks like
>
> <span style="font-family:Times;text-decoration:underline">Thank you for
> investing in our services</span>
>
> In my xsl-fo I have templates as
> <xsl:template match="html:span[@style='text-decoration:underline']">
<snip />
> <xsl:template
match="html:span[@style='font-family:Times;font-size:12pt']
| html:span[@style='font-size:Normalpt']">
<snip />
None of the above would be a match for the described span element. It would
help if you could provide us with a more complete picture of what you're
trying to do, but something like this may be of help:
<xsl:template match="span">
<fo:block>
<xsl:apply-templates select="@style">
<xsl:with-param name="prop-string" select="@style" />
</xsl:apply-templates>
</fo:block>
</xsl:template>
<xsl:template match="@style">
<xsl:param name="prop-string" select="''" />
<xsl:choose>
<xsl:when test="contains($prop-string,';')">
<xsl:attribute name="{substring-before($prop-string,':')}">
<xsl:value-of select="substring-before(substring-after(
$prop-string,':'),';')" />
</xsl:attribute>
<xsl:apply-templates select=".">
<xsl:with-param name="prop-string"
select="substring-after($prop-string,';')" />
</xsl:apply-templates>
</xsl:when>
<xsl:otherwise>
<xsl:attribute name="{substring-before($prop-string,':')}">
<xsl:value-of select="substring-after($prop-string,':')" />
</xsl:attribute>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
Hope this helps!
Greetz,
Andreas
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-user-help@xml.apache.org
Re: Applying multiple styles using span tag problem
Posted by JB...@s-s-t.com.
"recursively" is the answer. You need to write a recursive template that
you call when your style string contains a semi-colon (;). That template
then generates multiple <fo:inline> elements until the style string runs
out of semi-colons.
Jay Bryant
Bryant Communication Services
rohit.rastogi@pfpc.com
11/24/2004 09:21 AM
Please respond to
fop-user@xml.apache.org
To
fop-user@xml.apache.org
cc
Subject
Applying multiple styles using span tag problem
Hi
I have a span tag which looks like
<span style="font-family:Times;text-decoration:underline">Thank you for
investing in our services</span>
In my xsl-fo I have templates as
<xsl:template match="html:span[@style='text-decoration:underline']">
<fo:inline text-decoration="underline">
<xsl:apply-templates/>
</fo:inline>
</xsl:template>
<xsl:template match="html:span[@style='font-family: Times;
font-size:
12pt']|html:span[@style='font-size:Normalpt']">
<fo:block font-size="12pt" font-family="Times">
<xsl:apply-templates/>
</fo:block>
</xsl:template>
But only one of them is getting applied.I want to know how both the styles
can be applied recursively.
Thanks and Regards
Rohit
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-user-help@xml.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-user-help@xml.apache.org