Toon posts:

[XSLT] kind element selecteren en uitlezen

Pagina: 1
Acties:

Verwijderd

Topicstarter
Hoe kun je een kind element uit een element weergeven?
code:
code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
 <cd>
        <title box="1">Empire Burlesque</title>
        <artist>Bob Dylan</artist>
        <country>USA</country>
        <company>Columbia</company>
        <price>10.90</price>
        <year>1985</year>
    </cd>

    <cd>
        <title box="3">Down in the groove</title>
        <artist>Bob Dylan</artist>
        <country>USA</country>
        <company>Columbia</company>
        <price>11.50</price>
        <year>1988</year>
    </cd>



Nu wil ik graag dat de box nummers en de artiest worden weergegeven in een XSLT document..

Volgens mij moet dit met

[code]

<xsl:value-of select = "catalog/cd/artist"/>
<xsl:value-of select = "catalog/cd/title/box"/>

[\code]

maar dat werkt dus niet... :?

[ Voor 22% gewijzigd door Verwijderd op 25-03-2004 14:19 ]


  • Rickets
  • Registratie: Augustus 2001
  • Niet online

Rickets

Finger and a shift

Met templates kan het makkelijk
code:
1
2
3
<xsl:template match="cd">
  <xsl:value-of select="artist" />
</xsl:template>

If some cunt can fuck something up, that cunt will pick the worst possible time to fucking fuck it up, because that cunt’s a cunt.


Verwijderd

Topicstarter
Klopt.. dat werkt idd..

Thanx! _/-\o_

  • BezurK
  • Registratie: Juni 2001
  • Laatst online: 05-03 19:51
Rickets schreef op 25 maart 2004 @ 14:21:
Met templates kan het makkelijk
code:
1
2
3
<xsl:template match="cd">
  <xsl:value-of select="artist" />
</xsl:template>
En voor het boxnummer doe je:

code:
1
2
3
4
<xsl:template match="cd">
  <xsl:value-of select="artist" />
  <xsl:value-of select="title/@box" />
</xsl:template>

Rookworst zonder R is ook worst.


  • RM-rf
  • Registratie: September 2000
  • Laatst online: 26-05 19:49

RM-rf

1 2 3 4 5 7 6 8 9

het selecteren van elementen gaat eigenlijk met Xpath, deze heeft enorme mogelijkheden:
kijk hier eens naar:
http://www.zvon.org:9001/...T/xpathAxes.xslt&lang=eng
http://www.zvon.org/xxl/XPathTutorial/General/examples.html
of
http://msdn.microsoft.com.../htm/xpath_hdi_2_4s4h.asp

[ Voor 29% gewijzigd door RM-rf op 26-03-2004 09:29 ]

Intelligente mensen zoeken in tijden van crisis naar oplossingen, Idioten zoeken dan schuldigen