xsl-list
[Top] [All Lists]

RE: [xsl] add an attribute to an element, then use it in another template

2008-03-04 11:43:10
Hi,

  It looks like your output brought back two of the results you intend to 
output.
  I see only two <project> in your markup that do not include the first and the 
last of your desired output, which is what you told it to do--to give you back 
the results from the attributes?

  Is this really the entire markup you have?
 If you want to add the attributes and create new markup, I am sure others on 
the list might be able to help you out.

Alice
======================================================
Alice Wei
MIS 2008
School of Library and Information Science
Indiana University Bloomington
ajwei(_at_)indiana(_dot_)edu
________________________________________
From: Pablo Sebastian Rodriguez [psrodriguez(_at_)jusbaires(_dot_)gov(_dot_)ar]
Sent: Tuesday, March 04, 2008 1:26 PM
To: xsl-list(_at_)lists(_dot_)mulberrytech(_dot_)com
Subject: [xsl] add an attribute to an element, then use it in another template

hi,
i'm new using xsl, so please be patient... ;-)

the input is something like this:

<music>

    <project name="W.A.S.T.E">
        <release name="We all seek total entropy" year="2003"/>
        <release name="Violent delights" year="2006"/>
    </project>

    <project name="Winterkalte">
        <release name="Structures of Destruction" year="1997"/>
        <release name="Drum 'n' noise" year="1999"/>
    </project>

</music>


the xsl:

    <xsl:template match="music">
        <xsl:call-template name="attr">
            <xsl:with-param name="stuff" select="project"/>
        </xsl:call-template>
    </xsl:template>

    <xsl:template name="attr">
        <xsl:param name="stuff"/>
        <xsl:for-each select="$stuff/@*">

        attrName: <xsl:value-of select="name()"/>
        attrValue: <xsl:value-of select="."/>

        </xsl:for-each>
    </xsl:template>

the output:

attrName: name
attrValue: W.A.S.T.E

attrName: name
attrValue: Winterkalte


what i'm trying to do is add an attribute so the output will be:

attrName: newThing
attrValue: whoKnowsWhat

attrName: name
attrValue: W.A.S.T.E

attrName: name
attrValue: Winterkalte

attrName: adadad
attrValue qwertyu

i tried using <xsl:attribute> but i can't make it work... any ideas ?

thanks



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


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