xsl-list
[Top] [All Lists]

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-

2004-09-22 18:05:00
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(_dot_)sanwal(_at_)hp(_dot_)com> 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

--+------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: 
<mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--+--





-- 
www.GetFirefox.com !!


<Prev in Thread] Current Thread [Next in Thread>