[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Transforming Learning Object Metadata (LOM) proble
Thank you for the hints. So i've fixed some of the code and now the problematic part looks like <xsl:key name="gen-identifier" match="general/l:identifier/*" use="name()"/> <xsl:template match="l:general"> <xsl:apply-templates select="l:identifier"/> </xsl:template> <xsl:template match="l:identifier"> <xsl:for-each select="* [ count( . | key( 'gen-identifier', name() )[1] ) = 1 ] "> <FIELD name="<xsl:value-of select="local-name()"/>><br/> <xsl:for-each select="key('gen-identifier', local-name())"> <xsl:value-of select="current()"/><br/> </xsl:for-each> </FIELD><br/> </xsl:for-each> </xsl:template> and Here, the reason I'm using key is to group some of the same named elements in xml and print them in one field. For example, in the sample below, I'm outputting to field each named catalog and entry, with values of all catalogs together, and all entry values under other field. <general> <identifier> <catalog>Sample Catalog 1</catalog> <entry>Sample Entry 1</entry> </identifier> <identifier> <catalog>Sample Catalog 2</catalog> <entry>Sample Entry 2</entry> </identifier> .... and output is.. <FIELD name="catalog> Sample Catalog 1 Sample Catalog 2 </FIELD> <FIELD name="entry> Sample Entry 1 Sample Entry 2 </FIELD> <xsl:for-each select="* [ count( . | key( 'gen-identifier', name() )[1] ) = 1 ] "> above line was to print out only one <Field> for same named elements. and I used muenchen method for grouping the same named elements because it was handy to use. Should I avoid using keys in this situation? and Also by the way, How can I print new line in new xml file after conversion? to state this differently, what should I put in the xsl file to print new line like <br/> in new xml file? Thank you! -Jaebin On 9/12/06, David Carlisle <davidc@xxxxxxxxx> wrote:
|
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
|