This is the mail archive of the xsl-list@mulberrytech.com mailing list .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

RE: Need help with xsl-html conversion


Gudmundur,

You can use the xsl:attribute not only in relation to xsl:element but also
to output an attribut for an HTML tag. 
Try xsl:attribute as follows 

<h2>
   <a>
      <xsl:attribute name="name">
            <xsl:value-of select="@id"/>  ====> this is the content of the
name attribute
     </xsl:attribute>
     <xsl:value-of select="@id"/>     ===> this is the content of <a>...</a>
   </a>
</h2>

The rest should be done with xsl:sort and so on.

Barbara
---
Barbara Sellmer-Bruels
Klopotek & Partner GmbH - Berlin
E-Commerce

========================
Gu=F0mundur_Erlingsson?= <txakolin@bok.hi.is> wrote:


Hi,

I'm trying to set up a list of employees in xml, and I'm going to use xsl to
display it in two different ways, in alphabetical order and by departments.
In the alphabetical output (in html) I want to have all the characters in
the alphabet at the beginning of the file, and each character is a link to
the appropriate section. Nothing complex. The thing that I'm not sure of how
to implement is the <a name...> anchor. The xml-file is setup like this:

<file>
    <part id="A">
       <emp>
		<name>Allen, Jane</name>
		<job></job>
		<dep>Sales department</dep>
		<email>JAllen@blabla.com</email>
		<tel>8675668</tel>
       </emp>
    </part>
    <part id="B">
       <emp>
		<name>Bright, John</name>

etc....


The thing is that I'm trying to make a loop that goes through the file and
spits out html something like this:

   <h2><a name="A">A</a><h2>
   <p>Allen, Jane<br>
      Sales department<br>
      jallen@blabla.com<br>
      8675668</p>

and so on. Fairly simple. But I can't find a way to get the XSL loop to get
the value of the 'part' element and put it into the <a name=""> tag, between
the quotation marks. Meaning that I don't want to repeat the loop for every
single letter of the alphabet. So far the XSL part looks someting like this:

         <h2><a name=""></a><xsl:value-of select="@id"/></h2>
          <xsl:for-each select="starfsm">
           <p class="noindent">
             <xsl:choose>
               <xsl:when test="job[.='']"><xsl:value-of
select="nafn"/></xsl:when>
               <xsl:otherwise><xsl:value-of select="nafn"/>,
</xsl:otherwise>
             </xsl:choose>


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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]