Accessing XML using XSLT -



Accessing XML using XSLT -

i have xml of next format

<catalog> <cd> <title>cd name</title> </cd> </catalog>

i can utilize xslt element value using following:

<xsl:template match="/"> <xsl:for-each select="catalog/cd"> <xsl:value-of select="title" /> </xsl:for-each>

but, trying figure out xsl code read xml in next format:

<catalog> <cd title="cd name"/> </catalog>

how do this? , if can post xslt tutorial link, much appreciated.

thanks in advance

i have xml of next format <catalog> <cd> <title>cd name</title> </cd> </catalog> can utilize xslt element value using following: <xsl:template match="/"> <xsl:for-each select="catalog/cd"> <xsl:value-of select="title" /> </xsl:for-each> but, trying figure out xsl code read xml in next format: <catalog> <cd title="cd name"/> </catalog> how do this? , if can post xslt tutorial link, much appreciated.

this transformation:

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/xsl/transform"> <xsl:output method="text"/> <xsl:template match="cd"> <xsl:value-of select="concat(@title, '&#xa;')"/> </xsl:template> </xsl:stylesheet>

when applied on xml document:

<catalog> <cd title="cd1 name"/> <cd title="cd2 name"/> <cd title="cd3 name"/> </catalog>

produces wanted result:

cd1 name cd2 name cd3 name

for tutorials , books see reply question:

http://stackoverflow.com/questions/339930/any-good-xslt-tutorial-book-blog-site-online/341589#341589

xml xslt

Comments

Popular posts from this blog

java - How to set log4j.defaultInitOverride property to false in jboss server 6 -

c - GStreamer 1.0 1.4.5 RTSP Example Server sends 503 Service unavailable -

Using ajax with sonata admin list view pagination -