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

RE: Re[2]: question about symbols in attribute value

Subject: RE: Re[2]: question about symbols in attribute value
From: Jarno.Elovirta@xxxxxxxxx
Date: Tue, 11 Mar 2003 15:59:04 +0200
RE: Re[2]:  question about symbols in attribute value
Hi,

> I have data like this
> 
> <data field_delim="0x250" line_delim="0x13,0x10">
>    <field></field>
>    <field></field>
>    <data>
>     .....
>    <data>
> <data>
> 
> I want to get text
>          field_value @field_delim field_value @field_delim
>          .....@line_delim ...
> 
> if using example
>    
> field_value0x250field_value0x250.....0x130x10...field_value0x2
> 50field_value0x250

<xsl:output method="text" />

<xsl:variable name="field_delim" select="/data/@field_delim" />
<xsl:variable name="line_delim" select="translate(/data/@line_delim, ',', '')" />

<xsl:template match="/">
  <xsl:for-each select="data">
    <xsl:apply-templates select="field" />
    <xsl:apply-templates select="data" />
    <xsl:apply-templates select="field" />
  </xsl:for-each>
</xsl:template>

<xsl:template match="field">
  <xsl:text>field_value</xsl:text>
  <xsl:value-of select="." />
  <xsl:value-of select="$field_delim" />
</xsl:template>

<xsl:template match="data">
  <xsl:value-of select="normalize-space(.)" />
  <xsl:value-of select="$line_delim" />
  <xsl:text>...</xsl:text>
</xsl:template>

Will output what you specified above, though I don't know if it's what you want.

Cheers,

Jarno - Feindflug: In Gefangenschaft

 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

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.