[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Applying Templates to document loaded with document()
Hi ! I wish to try to match a template in my stylesheet to the nodes selected from the 'document("Author.xml")'. I have attached the file structures. Can someone please help ? TIA, Kunal File Structures: ==== Tutorial.xml ==== <?xml version="1.0" encoding="UTF-8" ?> <Tutorial> <AuthorList> <Author ID = "ID0001" /> <Author ID = "ID0002" /> </AuthorList> </Tutorial> ==== End of Tutorial.xml ==== ==== Author.xml ==== <?xml version="1.0" encoding="UTF-8" ?> <AuthorList> <Author ID = "ID0001"> <Title>Mr.</Title> <FirstName>Kunal</FirstName> <LastName>Parikh</LastName> <E-MailAddress>String</E-MailAddress> <Affiliation>String</Affiliation> <WebsiteAddress>http://www.project42.net</WebsiteAddress> <OtherInformation>String</OtherInformation> </Author> <Author ID = "ID0002"> <Title>Mr.</Title> <FirstName>Kunal</FirstName> <LastName>Parikh</LastName> <E-MailAddress>String</E-MailAddress> <Affiliation>String</Affiliation> <WebsiteAddress>http://www.project42.net</WebsiteAddress> <OtherInformation>String</OtherInformation> </Author> </AuthorList> ==== End of Author.xml ==== ==== Tutorial.xsl ==== <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:import href="Identity.xsl"/> <xsl:output method="xml" indent="yes" /> <xsl:variable name="authors" select="document('Author.xml')" /> <xsl:key name="authors" match="Author" use="@ID" /> <xsl:template match="Author"> <xsl:variable name="ID" select="@ID" /> <xsl:for-each select="$authors"> <xsl:copy-of select="key('authors', $ID)" /> </xsl:for-each> </xsl:template> <xsl:template match="FirstName"> <TestElement>SuccessFull</TestElement> </xsl:template> </xsl:stylesheet> ==== End of Tutorial.xsl ==== XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|