xsl-list
[Top] [All Lists]

Re: extrat value from current node only.

2005-03-30 05:29:15
Hi Emmanuel,
  Please try this XSL..

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

  <xsl:template match="items">
    <xsl:apply-templates select="item"/>
  </xsl:template>

  <xsl:template match="item">
    title:<xsl:value-of
select="normalize-space(text())"/>
    description:<xsl:value-of select="description"/>
  </xsl:template>

</xsl:stylesheet>

The output produced is:
<?xml version="1.0" encoding="UTF-8"?>
    title:title 1
    description:description 1
    title:title 2
    description:description 2

Also should'nt you use
<xsl:output method="text" /> ..? (unless you want a
XML output)

Regards,
Mukul

--- emmanuel ide <emmanuel(_at_)jazar(_dot_)co(_dot_)uk> wrote:
Hi Guys,

My fist post on this mailing list. Just started
learning xsl yesterday, and
already come across an issue which I cannot solve
with the W3C tutorial ...
:

Below are my xml & xls file:

________________ XML FILE _______________________

<?xml version="1.0" encoding="UTF-8" ?>
<items>
      <item>
         title 1
         <description>description 1</description>
      </item>
      <item>
         title 2
         <description>description 2</description>
      </item>
</items>
_________________________________________________

________________ XLS FILE _______________________
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform";> 

  <xsl:template match="items">
    <xsl:apply-templates select="item"/>
  </xsl:template>

  <xsl:template match="item">
    title:<xsl:value-of select="current()"/>
    description:<xsl:value-of select="description"/>
  </xsl:template>

</xsl:stylesheet>
___________________________________________________

I don't get
<?xml version="1.0" encoding="UTF-8"?>
    title:title 11
    description:description 1

But ...
<?xml version="1.0" encoding="UTF-8"?>
    title:
         title 1
         description 1
      
    description:description 1
    title:
         title 2
         description 2
      
    description:description 2

What changes do I have to make to my xls file to get
the output I want?

Thank you for you help.

Emmanuel



--~------------------------------------------------------------------
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>
--~--




                
__________________________________ 
Do you Yahoo!? 
Yahoo! Small Business - Try our new resources site!
http://smallbusiness.yahoo.com/resources/ 

--~------------------------------------------------------------------
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>