xsl-list
[Top] [All Lists]

Re: Can I use <xsl:key>

2005-09-06 23:32:39
Hi Ragulf,
   Thanks for your response. I see your point, I'm a
beginner in XSLT programming, that's why sometimes I
rely on this forum in search for my problem. I've
tried different simple XML structure, and I transform
it with want I want, but the XML that I posted really
bothered me, I know that for some, it only simple, but
as a newbie, its hard for me to transform that.

Here is my initial XSL, 

<xsl:template match="root">
        <xsl:element name="ce:author-group">          
 
            <xsl:for-each
select="text:p/text:span/text:user-field-get[(_at_)text:name='ce:author']"

                <xsl:element name="{(_at_)text:name}">     
                       
                                            
                        <xsl:call-template
name="author_given_name">
                            <xsl:with-param
name="authorCTR" select="position()"></xsl:with-param>
                                      
                        </xsl:call-template>          
              
                        
                        <xsl:call-template
name="author_surname">
                            <xsl:with-param
name="authorCTR" select="position()"></xsl:with-param>
                                      
                        </xsl:call-template>          
              
                        
                    <xsl:call-template
name="author_email_start">
                            <xsl:with-param
name="authorCTR" select="position()"></xsl:with-param>
                                      
                    </xsl:call-template>
                    
                        <xsl:call-template
name="author_email_end">
                            <xsl:with-param
name="authorCTR" select="position()"></xsl:with-param>
                                      
                        </xsl:call-template>          
               

                </xsl:element>
            </xsl:for-each>
        </xsl:element>                    
        
    </xsl:template>
    
    <!-- Author Given Name template -->
    <xsl:template
match="//text:user-field-get[(_at_)text:name='ce:given-name']"
 name="author_given_name">
        <xsl:param name="authorCTR"/>        
        <xsl:for-each
select="//text:user-field-get[(_at_)text:name='ce:given-name']">
       
            <xsl:if test="$authorCTR=position()">
                <xsl:element name="{(_at_)text:name}">
                    <xsl:value-of
select="./following::text:span/text()"/>
                    <xsl:value-of
select="parent::text:span/following::text()"/>        
           
                </xsl:element>                        
  
            </xsl:if>    
        </xsl:for-each>
    </xsl:template>                  
    
    <!-- Author Surname template -->    
    <xsl:template
match="//text:user-field-get[(_at_)text:name='ce:surname']"
 name="author_surname">
        <xsl:param name="authorCTR"/>        
        <xsl:for-each
select="//text:user-field-get[(_at_)text:name='ce:surname']">
       
            <xsl:if test="$authorCTR=position()">
                <xsl:element name="{(_at_)text:name}">
                    <xsl:value-of
select="./following::text:span/text()"/>              
     
                    <xsl:value-of
select="parent::text:span/following::text()"/>        
           
                </xsl:element>                        
  
            </xsl:if>    
        </xsl:for-each>
    </xsl:template>                  
    
    <!--Process   ce:email -->
    <xsl:template
match="//text:user-field-get[(_at_)text:name='ce:e-address']
|
//text:span/text:user-field-get[(_at_)text:name='ce:e-address']"
 name="author_email_start">
        <xsl:param name="authorCTR"/>
        <xsl:for-each
select="//text:user-field-get[(_at_)text:name='ce:e-address']
|
//text:span/text:user-field-get[(_at_)text:name='ce:e-address']">
       
            <xsl:if test="$authorCTR=position()">
                <xsl:text
disable-output-escaping="yes">&#x003C;ce:e-address&#x003E;</xsl:text>
           
                <xsl:value-of
select="./following::text:span/text()"/>              
     
                <xsl:value-of
select="parent::text:span/following::text()"/>        
           
            </xsl:if>    
        </xsl:for-each>
    </xsl:template>                  
    
    <xsl:template
match="//text:user-field-get[(_at_)text:name='/ce:e-address']
|
//text:span/text:user-field-get[(_at_)text:name='/ce:e-address']"
 name="author_email_end">
        <xsl:param name="authorCTR"/>
        <xsl:for-each
select="//text:user-field-get[(_at_)text:name='/ce:e-address']
|
//text:span/text:user-field-get[(_at_)text:name='/ce:e-address']">
       
            <xsl:if test="$authorCTR=position()">    
                <xsl:text
disable-output-escaping="yes">&#x003C;/ce:e-address&#x003E;</xsl:text>
               
            </xsl:if>
        </xsl:for-each>
    </xsl:template>    


well, hope you understand, my problem is, the e-mail
add were not in the place that was supposed to be.
Can you give me some thoughts about this.

regards.
aaron




        
                
______________________________________________________
Click here to donate to the Hurricane Katrina relief effort.
http://store.yahoo.com/redcross-donate3/

--~------------------------------------------------------------------
XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--



<Prev in Thread] Current Thread [Next in Thread>