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

Re: Applying template conditionally

Subject: Re: Applying template conditionally
From: Dan Diebolt <dandiebolt@xxxxxxxxx>
Date: Fri, 27 Apr 2001 13:42:59 -0700 (PDT)
apply templates conditionally xsl
>Sorry :(  I was trying not to make the post too long,
>and was hoping my description of the problem would be
>sufficient.

I simplified your problem to just transforming your cell's
children & attributes to attributes of row. My solution 
is a bit inelegent but I still don't understand what you 
want done with all of the ExtendedAttribute pieces, what
you want the attributes named or if you have to dynamically
create the attribute names.

Regards,

Dan

File: Spreadsheet27April2001.xml
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="Spreadsheet27April2001.xsl"?>

<root>
  <row>
    <cell column="1">*OrganizationCode</cell>
    <cell column="2">*RFQName</cell>
    <cell column="3">*RFQCode</cell>
    <cell column="4">*RFQType</cell>
    <cell column="5">*RFQSubscription</cell>
  </row>
  <row>
    <cell column="1">abc</cell>
    <cell column="2">00Test Import 3</cell>
    <cell column="3">00Test Import 3</cell>
    <cell column="4">reverse</cell>
    <cell column="5">public</cell>
  </row>
</root>

File: Spreadsheet27April2001.xsl
<?xml version="1.0"?>

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

 <xsl:output indent="yes"/>
 
 <xsl:template match="/">
  <xsl:apply-templates select="root"/>
 </xsl:template>

 <xsl:template match="root">
  <xsl:copy>
   <xsl:apply-templates select="row"/>
  </xsl:copy>
 </xsl:template>
 
 <xsl:template match="row">
  <xsl:copy>
   <xsl:apply-templates select="cell[@column='1']"/>
   <xsl:apply-templates select="cell[@column='2']"/>
   <xsl:apply-templates select="cell[@column='3']"/>
   <xsl:apply-templates select="cell[@column='4']"/>
   <xsl:apply-templates select="cell[@column='5']"/>
   <xsl:apply-templates select="cell[@column='6']"/>
  </xsl:copy>
 </xsl:template>

 <xsl:template match="cell[@column='1']">
  <xsl:attribute name="column1">
   <xsl:value-of select="text()"/>
  </xsl:attribute>
 </xsl:template>
 
 <xsl:template match="cell[@column='2']">
  <xsl:attribute name="column2">
   <xsl:value-of select="text()"/>
  </xsl:attribute>
 </xsl:template>
 
 <xsl:template match="cell[@column='3']">
  <xsl:attribute name="column3">
   <xsl:value-of select="text()"/>
  </xsl:attribute>
 </xsl:template>
 
 <xsl:template match="cell[@column='4']">
  <xsl:attribute name="column4">
   <xsl:value-of select="text()"/>
  </xsl:attribute>
 </xsl:template>
 
 <xsl:template match="cell[@column='5']">
  <xsl:attribute name="column5">
   <xsl:value-of select="text()"/>
  </xsl:attribute>
 </xsl:template>
 
 <xsl:template match="cell[@column='6']">
  <xsl:attribute name="column6">
   <xsl:value-of select="text()"/>
  </xsl:attribute>
 </xsl:template>
</xsl:stylesheet>

__________________________________________________
Do You Yahoo!?
Yahoo! Auctions - buy the things you want at great prices
http://auctions.yahoo.com/

 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.