xsl-list
[Top] [All Lists]

Re: [xsl] Renaming an element when using copy-of

2006-06-20 12:50:33
Hi,
pls try below xsl (modified your xsl):
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; version="1.0">
        <xsl:output method="xml" indent="yes"/>
        <xsl:template match="Root">
                <ArticleSet>
                        <Article>
                                <Journal>
                                        <PublisherName>
                                                <xsl:apply-templates 
select="Source/PublisherName"/>
                                        </PublisherName>
                                        <JournalTitle>
                                                <xsl:apply-templates 
select="Source/Publication"/>
                                        </JournalTitle>
                                        <Issn>
                                                <xsl:apply-templates 
select="Source/Issn"/>
                                        </Issn>
                                        <Volume>
                                                <xsl:apply-templates 
select="Source/Volume"/>
                                        </Volume>
                                        <Issue>
                                                <xsl:apply-templates 
select="Source/Issue"/>
                                        </Issue>
                                        <PubDate>
                                                <Year>
                                                        <xsl:apply-templates 
select="Source/Date/Year"/>
                                                </Year>
                                                <Month>
                                                        <xsl:apply-templates 
select="Source/Date/Month"/>
                                                </Month>
                                        </PubDate>
                                </Journal>
                                <ArticleTitle>
                                        <xsl:apply-templates 
select="Story/articleTitle"/>.
                   <xsl:apply-templates select="Story/articleSubTitle"/>
                                </ArticleTitle>
                                <FirstPage>
                                        <xsl:apply-templates 
select="Source/FirstPage"/>
                                </FirstPage>
                                <LastPage>
                                        <xsl:apply-templates 
select="Source/LastPage"/>
                                </LastPage>
                                <!-- This is the section were I want <author> to be 
<Author> -->
                                <AuthorList>
                                        <xsl:apply-templates 
select="Story/author"/>
                                </AuthorList>
                                <Abstract>
                                        <xsl:apply-templates 
select="Story/abstract_body"/>
                                </Abstract>
                        </Article>
                </ArticleSet>
        </xsl:template>
        <xsl:template match="Story/author">
                <Author>
                        <xsl:copy-of select="./*"/>
                </Author>
        </xsl:template>
</xsl:stylesheet>

but i found your xsl file contains very less <xsl:template> elements,
you included a major chunk within a single <xsl:template> element. it
is recommended to define <xsl:template> element matching certain sets
of elements, child elements.

Greetings,

Jagdishwar B.

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