Subject: Re: To Split, Pick/Select, Obtain and use Values from a single XHTML style ="..." attribute containing Bunched Formatting Attributes in it. style="TABLE-LAYOUT: fixed; WIDTH: 591px; BORDER-TOP-STYLE: none; BORDER-RIGHT-STYLE: none; BORDER-LEFT-
From: Francesco Barresi <kywocs@xxxxxxxxx>
Date: Wed, 22 Sep 2004 21:05:00 -0400
|
Hi,
You could use something like this:
<xsl:template name="stripStyles">
<!-- the param $stringToStrip must be in this form:
$stringToStrip = "TABLE-LAYOUT: fixed;
WIDTH: 591px; BORDER-TOP-STYLE: none; BORDER-RIGHT-STYLE: none;
BORDER-LEFT-STYLE: none; BORDER-COLLAPSE: collapse; WORD-WRAP:
break-word; BORDER-BOTTOM-STYLE: none"
-->
<xsl:param name="stringToStrip" select="''"/>
<xsl:if test="$stringToStrip != ''">
<xsl:variable name="subString" select="substring-before($stringToStrip,';')"/>
<style>
<name>
<xsl:value-of select="substring-before($subString,':')"/>
</name>
<value>
<xsl:value-of select="substring-after($subString,':')"/>
</value>
</style>
<xsl:call-template name="stripStyles">
<xsl:with-param name="stringToStrip"
select="substring-after($stringToStrip,';')"/>
</xsl:call-template>
</xsl:if>
</xsl:template>
and the result of the template is this:
<style>
<name>TABLE-LAYOUT</name>
<value> fixed</value>
</style>
<style>
<name> WIDTH</name>
<value> 591px</value>
</style>
<style>
<name> BORDER-TOP-STYLE</name>
<value> none</value>
</style>
<style>
<name> BORDER-RIGHT-STYLE</name>
<value> none</value>
</style>
<style>
<name> BORDER-LEFT-STYLE</name>
<value> none</value>
</style>
<style>
<name> BORDER-COLLAPSE</name>
<value> collapse</value>
</style>
<style>
<name> WORD-WRAP</name>
<value> break-word</value>
</style>
<style>
<name></name>
<value></value>
</style>
It isn't the state-of-the-art, just look at the empty <style> added at
the end, and it could use less variables, but this is just an example
so it can be a start.
I hope I helped.
Bye
Francesco.
On Wed, 22 Sep 2004 19:15:49 -0500, SANWAL, ABHISHEK (HP-Houston)
<abhishek.sanwal@xxxxxx> wrote:
> <table class="MsoNormalTable msoUcTable" style="TABLE-LAYOUT: fixed;
> WIDTH: 591px; BORDER-TOP-STYLE: none; BORDER-RIGHT-STYLE: none;
> BORDER-LEFT-STYLE: none; BORDER-COLLAPSE: collapse; WORD-WRAP:
> break-word; BORDER-BOTTOM-STYLE: none" tabIndex="-1" cellPadding="0"
> border="1">
>
> How would I write an XSL module to pick up and split up the single
> attribute style="...." and obtain the "named" ATTRIBUTES that have been
> bunched inside this X-HTML produced by InfoPath?
>
> An xsl that allowed me to obtain them by "NAME" would be great.
>
> An xsl that went through the entire thing and extracted and mapped
> attributes that I have pre-defined in a match list would be even better
> :).
>
> Kindly advise oh gods of recursive xsl attribute tokenizers :).
>
> I am having a tough time trying to figure out the best way to do this
> efficiently. I know that it could involve use of substring() matches.
>
> I don't know, maybe some ideas or code might give me some direction.
>
> Thanks,
>
> Abhishek
> ____________________________________________________________
>
> Abhishek Sanwal
> HP - Houston Campus
>
>
--
www.GetFirefox.com !!
| <- Previous | Index | Next -> |
| To Split, Pick/Select, Obtain, SANWAL, ABHISHEK (HP
|
Thread |
RE: XSL Beginner Resources [w, SANWAL, ABHISHEK (HP
|
| Re: calling a template and xs, Robert Koberg
|
Date |
RE: To Split, Pick/Select, Ob, SANWAL, ABHISHEK (HP
|
|
Month |
|
|