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

Re: copy of specific elements

Subject: Re: copy of specific elements
From: henry human <henry_human@xxxxxxxx>
Date: Mon, 18 Aug 2008 15:21:28 +0200 (CEST)
Re:  copy of specific elements
I tried with the FAQ and i understood it so as i am
witing the code snippet bellow!
Here is the sample. 
In this loop it should turns 2 times because there are
2 sections and than displays the 
author names in:
author[1] and 
author[2]
(this is the array: [@type='author'][position()])
But It does not work properly.
I am thankful for your help

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

xmlns:wpc="com.sap.nw.wpc.km.service.linkmanager.XsltHelper">
	<xsl:output method="html"/>
  <xsl:template match="/">

    <html>
<body>
  
 <xsl:variable name="var" 
select="count(document/elements/element[@type='section'])"/>
 <xsl:for-each select="//*[position() &lt;= $var]">
 
 <!--
 <xsl:value-of disable-output-escaping="yes"
select="document/elements/element[@type='author'][position()]"/>
-->
      LOOP:  <xsl:value-of
disable-output-escaping="yes" select="position()"/>

      
      
   </xsl:for-each>
     
     
     


</body>
</html>

  </xsl:template>
</xsl:stylesheet>

--------------------xml file -------------------

<?xml version="1.0" encoding="iso-8859-1"?>
<?xml-stylesheet type="text/xsl"
href="text-_ohne-loop.xsl" ?>

<document>

<elements>
        <element type="author"
description="xml.xlbl.author"  size="25"
default="true">
         Author number 1</element>
		<element type="author" description="xml.xlbl.author"
 size="25" default="true">
        Author number 2</element>

        <element type="section"
description="xml.xlbl.author"  size="25"
default="true">
        section 1</element>
        
        <element type="section"
description="xml.xlbl.author"  size="25"
default="true">
        section 2</element>


	</elements>
</document>





--- Florent Georges <lists@xxxxxxxxxxxx> schrieb:

> henry human wrote:
> 
> >   position() doesn't behave as you seem to think
> it
> > does.  What you get
> > means there are in the input tree 6 elements that
> are
> > the first or
> > second child of their parent element.
> > 
> > Could you say how to build this loop correctly ??
> 
>   I suggest looking in the FAQ for position().  It
> should be clearer
> than what I could give you here.
> 
>   For your particular problem, I don't see exactly
> what you want from
> your explanation.  You should post a simple
> (simplified) example of
> input, and the corresponding output you would like
> to have from this
> particular input.  Choose both examples carefully in
> order to make the
> relation between both as clear as possible.
> 
>   Regards,
> 
> --drkm
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
>      
>
_____________________________________________________________________________
> 
> Envoyez avec Yahoo! Mail. Une boite mail plus
> intelligente http://mail.yahoo.fr
> 
> 


__________________________________________________
Do You Yahoo!?
Sie sind Spam leid? Yahoo! Mail verf|gt |ber einen herausragenden Schutz gegen Massenmails. 
http://mail.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-2011 All Rights Reserved.