[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: To Split, Pick/Select, Obtain and use Values from

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
xsl word wrap
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 !!

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.