This is the mail archive of the
xsl-list@mulberrytech.com
mailing list .
RE: generating text from an attribute
- To: "'xsl-list at mulberrytech dot com'" <xsl-list at mulberrytech dot com>
- Subject: RE: generating text from an attribute
- From: "Foster, Justin (IT_Architecture)" <JFoster at russell dot com>
- Date: Tue, 18 Jul 2000 08:28:20 -0700
- Reply-To: xsl-list at mulberrytech dot com
So if I have a structure like:
<ROOT>
<PARENT>
<CHILD1 att1="1" att2="2" att3="3"/>
<CHILD2 att1="1" att2="2" att3="3"/>
</PARENT>
</ROOT>
and I would like to output each attribute under each child as text in the
template, then I should write:
> <xsl:template name="CHILD1">
<xsl:foreach select="@att1">
<xsl:foreach select="@att2">
<xsl:foreach select="@att3">
</xsl:template>
> <xsl:template name="CHILD2">
<xsl:foreach select="@att1">
<xsl:foreach select="@att2">
<xsl:foreach select="@att3">
</xsl:template>
and I don't need to include and <xsl:value-of select="att1"/> type
statements??
Thanks for clearing this up for me!
>
>
>
>
Justin Foster
IT Architecture
253-596-3260 office
253-223-3108 mobile
> ----------
> From: Spychalski, Frank[SMTP:frank.spychalski@sap.com]
> Reply To: xsl-list@mulberrytech.com
> Sent: Monday, July 17, 2000 3:54 PM
> To: 'xsl-list@mulberrytech.com'
> Subject: RE: generating text from an attribute
>
> ->-----Original Message-----
> ->From: Foster, Justin (IT_Architecture) [mailto:JFoster@russell.com]
> ->Subject: generating text from an attribute
> ->
> ->
> ->Here's a newbie question.
> ->
> ->How do I generate the value of a attribute as text:
> ->
> ->i.e.
> ->
> -><ROOT>
> -> <PARENT>
> -> <CHILD name="Bob" age="20"/>
> -> </PARENT>
> -></ROOT>
> ->
> ->
> ->I want to output to html:
> ->
> -><HTML>
> -><HEAD>
> -></HEAD>
> -><BODY>
> ->My name is Bob. I am 20 years old.</BODY>
> -></HTML>
>
> You need something like:
>
> <xsl:template name="PARENT">
> My name ist <xsl:value-of select="CHILD/@name"/>. I am <xsl:value-of
> select="CHILD/@age"/> years old.
> </xsl:template>
>
> if you have multiple childs add a <xsl:foreach select="CHILD"> ... </..>
> and
> change CHILD/@name to @name
>
> Frank
> -
> Work is the curse of the drinking class. (Oscar Wilde)
> Frank Spychalski frank@spychalski.de
>
>
> XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
>
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list