Jump to content

Woiz

Members
  • Content Count

    2
  • Joined

  • Last visited

Community Reputation

0 Neutral

About Woiz

  • Rank
    Newbie
  1. I solved the problem on my own. Somehow it just works, if I create a template for each attribute without any use of the "for-each" function. Bit unsexy but works. Thanks anyway
  2. Hi all! I'm trying to redesign a xml-File via a xslt-Stylesheet and somehow it doesn't do, what I want it to, so... The structure of my xml-file is basically like this: <root><text><articletitle/><date/><content><p><p>...</content></text><text><articletitle>...</text></root> So, the xml-file consists of several articles which are contained within the <text /> tags. Each article has several meta-information as for example the <articletitle/> and <date/>. The <content> tags include the actual text of the article. What I would like to do, is rewrite the meta-info as an attribute, so the new xml-file structure looks like this: <root><text articletitle="This is a title" date="This is a date"><content><p>...</content></text><text articletitle="This is another title" date="This is another date"><content><p>...</content></text></root> What I managed to do, is get the correct structure, however, the title and date seem to be always the one of the first article. Here's an excerpt of my xsl-stylesheet: <xsl:template match="/"><root><xsl:for-each select="//root/text"><text> <xsl:attribute name="articletitle"><xsl:value-of select="normalize-space(//root/text/articletitle)"/></xsl:attribute> <xsl:attribute name="date"><xsl:value-of select="normalize-space(//root/text/date)"/></xsl:attribute> <xsl:apply-templates/></text></xsl:for-each> </root></xsl:template> What I thought I did, was to tell it to run through all the nodes at "root/text" and apply the attributes. But as I said before, it does generate the correct structure for each article, but just enters the information of the first article under "articletitle" and "date". I'd very much appreciate your help. CheersWoiz
×
×
  • Create New...