Altova Mailing List Archives>Archive Index >microsoft.public.xsl Archive Home >Recent entries >Thread Prev - Re: Beginner's questions [Thread Next] Re: Beginner's questionsTo: NULL Date: 8/7/2007 8:16:00 AM "Howard Brazee" <howard@b...> wrote in message news:2tq3b3d1gg2uqrqivbfs9sd0gpqpe9bh8r@4...... > On Thu, 2 Aug 2007 08:40:38 +0100, "Joe Fawcett" > <joefawcett@n...> wrote: > >>Regarding your first point you can create an HTML/HTA page that will use >>the >>iTunes.xml as a source and control the transformation via script, load the >>XML into a DomDocument, the same with the XSLT and then transform the XML >>and add the result to the page. There are examples of this in the msxml >>sdk. > > It looks like I have a lot of research to do here. > >>As to the actual transform I agree it's made tricky by the non-nested >>nature >>of the XML but if you only want those three columns then you just need to >>apply-templates to key elements and test the value or narrow down the >>selection with a predicate: >><xsl:apply-templates select="key[. = 'Name']"/> >><xsl:apply-templates select="key[. = 'Rating']"/> >> >>You can then retrieve the first following-sibling: >><xsl:value-of select="following-sibling::*[1]"/> > > That is similar to what I have done to get the header information: > ================ > <xsl:template match='/'> > <html><body> > <h2>My iTune Collection > <xsl:apply-templates > select='/plist/dict/child::key[position()<8]'/> > </h2> > > <br/><br/><xsl:apply-templates select='/plist/dict/dict//dict'/> > </body></html> > </xsl:template> > ==================== > > <xsl:template match='key'> > <xsl:call-template name='showNextSiblingVal'> > <xsl:with-param name='firstSiblingVal' select='.'/> > </xsl:call-template> > </xsl:template> > > <xsl:template name='showNextSiblingVal'> > <xsl:param name='firstSiblingVal'/> > <xsl:if test='. = $firstSiblingVal'> > <br/><xsl:value-of select='.'/>: <xsl:value-of > select='following-sibling::*'/> > </xsl:if> > </xsl:template> > ============================= > > I will play with it for my code within: > <xsl:template match='dict'> > <xsl:for-each select='key'> > ============== > > How do I add a column which just has a sequence number? > > You can use <xsl:value-of select="position()"/> which shows the position of the context node in the current sequence. -- Joe Fawcett (MVP - XML) http://joe.fawcett.name | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
