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

RE: atrtributes

Subject: RE: atrtributes
From: Jody Robert Ford <jody.r.ford@xxxxxxxxx>
Date: Wed, 1 Mar 2006 07:07:20 -0500
unit conversio
Hey,
I did figure out how to ignore heterogeneous. But, I'm also trying to group
the information hierarchically.


 <TOSET>

   <HETROGENEOUS>true</HETROGENEOUS>

  <TO CLASS="Sub Unit View">

    <A N="Echelon" V="RGT"/>

    <A N="Seq Num" V="1"/>

    <A N="Assoc Unit Id" V="C1"/>

    <A N="Assoc Unit Name" V="Charlie"/>

    <A N="Assoc Unit SK" V="88"/>

    <A N="Unit Id" V="A2"/>

    <A N="Unit Name" V="Apple"/>

    <A N="Unit Num" V="011"/>

    <A N="Unit SK" V="844"/>

  </TO>

<TO CLASS="Sub Unit View">

      <A N="Echelon" V="BDE"/>

      <A N="Seq Num" V="1"/>

      <A N="Assoc Unit Id" V="02"/>

      <A N="Assoc Unit Name" V="Baker"/>

      <A N="Assoc Unit SK" V="02"/>

      <A N="Unit Id" V="C1"/>

      <A N="Unit Name" V="Charlie"/>

      <A N="Unit Num" V="06"/>

      <A N="Unit SK" V="88"/>

   </TO>

<TO CLASS="Sub Unit View">

      <A N="Echelon" V="RGT"/>

      <A N="Seq Num" V="1"/>

      <A N="Assoc Unit Id" V="C1"/>

      <A N="Assoc Unit Name" V="Charlie"/>

      <A N="Assoc Unit SK" V="88"/>

      <A N="Unit Id" V="A1"/>

      <A N="Unit Name" V="Alpha"/>

      <A N="Unit Num" V="01"/>

      <A N="Unit SK" V="84"/>

   </TO>

<TO CLASS="Sub Unit View">

      <A N="Echelon" V="BN"/>

      <A N="Seq Num" V="20"/>

      <A N="Assoc Unit Id" V="A1"/>

      <A N="Assoc Unit Name" V="Alpha"/>

      <A N="Assoc Unit SK" V="84"/>

      <A N="Unit Id" V="B1"/>

      <A N="Unit Name" V="Beta"/>

      <A N="Unit Num" V="01"/>

      <A N="Unit SK" V="8"/>

</TO>

<TO CLASS="Sub Unit View">

      <A N="Echelon" V="BN"/>

      <A N="Seq Num" V="21"/>

      <A N="Assoc Unit Id" V="A1"/>

      <A N="Assoc Unit Name" V="Alpha"/>

      <A N="Assoc Unit SK" V="84"/>

      <A N="Unit Id" V="B2"/>

      <A N="Unit Name" V="Betty"/>

      <A N="Unit Num" V="11"/>

      <A N="Unit SK" V="81"/>

</TO>



</TOSET>







using

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

  <xsl:key name="parent" match="A" use="A[@N='Assoc Unit SK']/@V"/>

  <xsl:key name="id" match="A" use="A[@N='Assoc SK']/@V"/>

  <xsl:template match="HETROGENEOUS"></xsl:template>

  <xsl:template match="/">

    <tr>

      <xsl:apply-templates select="key('parent', 'id')"/>

    </tr>

  </xsl:template>

  <xsl:template match="TO">

        <td>

          <xsl:value-of select="A[@N='Unit SK']/@V"/>

        </td>

        <td>

          <xsl:value-of select="A[@N='Unit Name']/@V"/>

        </td>

    <xsl:apply-templates select="key('parent', 'id')"/>

  </xsl:template>


</xsl:stylesheet>



that produces



<table>

<tr><td>88</td><td>Charlie</td></tr>

<tr><td>84</td><td>Alpha</td></tr>

<tr><td>8</td><td>Beta</td></tr>

<tr><td>81</td><td>Betty</td></tr>

<tr><td>844</td><td>Apple</td></tr>

</table>



Thank you for any help.

-----Original Message-----
From: Jay Bryant [mailto:jay@xxxxxxxxxxxx]
Sent: Tuesday, February 28, 2006 11:25 PM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: Re:  atrtributes

Sure. And in a couple different ways.

One way is to apply only certain templates. Consider the following
stylesheet fragment:

<xsl:template match="TOSET">
  <xsl:apply-templates select="TO"/>
</xsl:template>

<xsl:template match="TO">
  <!-- Do some stuff here -->
</xsl:template>

Because the TOSET template applies only the TO template, the HETROGENEOUS
element never gets matched and is thus "ignored". (We'd generally say the
HETROGENEOUS node is not processed.)

The other way is to apply templates to everything and specifically not
process certain nodes, thus:

<xsl:template match="TOSET">
  <xsl:apply-templates/>
</xsl:template>

<xsl:template match="TO">
  <!-- Do some stuff here -->
</xsl:template>

<xsl:template match="HETROGENEOUS "/>

Which one you should use depends on what you are doing and is also a matter
of personal style.

HTH

Jay Bryant
Bryant Communication Services

----- Original Message -----
From: "Jody Robert Ford" <jody.r.ford@xxxxxxxxx>
To: <xsl-list@xxxxxxxxxxxxxxxxxxxxxx>
Sent: Tuesday, February 28, 2006 6:55 PM
Subject: RE:  atrtributes


Can I have the style sheet ignore <HETROGENEOUS>true</HETROGENEOUS>?
Thanks for your help.
----
<HETROGENEOUS>true</HETROGENEOUS>
    <xsl:template match="TO">
      <xsl:value-of select="A[@N='Assoc Unit Id']/@V"/>
      <xsl:text>&#09;</xsl:text>
      <xsl:value-of select="A[@N='Assoc Unit Name']/@V"/>
      <xsl:text>&#10;</xsl:text>
    </xsl:template>

---

-----Original Message-----
From: Florent Georges [mailto:darkman_spam@xxxxxxxx]
Sent: Tuesday, February 28, 2006 7:15 PM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: RE:  atrtributes

Jody Robert Ford wrote:

> Can anyone explain how to access attributes in an xsl/xslt?
> Where do I start my research?

  In any good XSLT tutorial?

> How would you display a list like this:

> 02 Baker
> C1 Charlie
> A1 Alpha
> A2 Annie

    <xsl:template match="TO">
      <xsl:value-of select="A[@N='Assoc Unit Id']/@V"/>
      <xsl:text>&#09;</xsl:text>
      <xsl:value-of select="A[@N='Assoc Unit Name']/@V"/>
      <xsl:text>&#10;</xsl:text>
    </xsl:template>

--drkm























___________________________________________________________________________
Nouveau : tiliphonez moins cher avec Yahoo! Messenger ! Dicouvez les tarifs
exceptionnels pour appeler la France et l'international.
Tilichargez sur http://fr.messenger.yahoo.com

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.