![]() |
![]() | ![]() | ![]() | Altova Mailing List Archives>Archive Index >microsoft.public.xsl Archive Home >Recent entries >Thread Prev - XSL to Combine attributes from two nodes >Thread Next - Re: XSL to Combine attributes from two nodes RE: XSL to Combine attributes from two nodesTo: NULL Date: 12/8/2006 1:16:00 AM the probleme is the xpath here <xsl:attribute name="DateLoaded"> <xsl:value-of select="u[@DateLoaded]"/> </xsl:attribute> 1- Don't forget xml/spath is case sensitive there is a tag U but not tag u 2- here you select the u element with a DateLoaded attribute not the DateLoaded attibute try this <xsl:attribute name="DateLoaded"> <xsl:value-of select="U/@DateLoaded"/> </xsl:attribute> -- My english is (very) rusted ,please , don''''t hesitate to correct me Thanks rédacteur/modérateur xml sur developpez.com "jake319@g..." wrote: > I have what seems like a simple XSL question. I want to combine the > attributes of two different nodes together. Here is some sample XML: > <?xml version="1.0" encoding="utf-8" ?> > <S Number="21002" Name="North" State="Georgia" > > <U DateLoaded="2006-11-28" ></U> > </S> > > The goal is for the XML to look like so (really, just add the > DateLoaded attribute to <S>: > > <S Number="21002" Name="North" State="Georgia" DateLoaded="2006-11-28"> > > > Here is some XSL that is NOT adding the correct value for "DateLoaded" > to the result, rather, the value is blank: > > <xsl:template match="root"> > <xsl:element name="root" namespace="http://tempuri.org/root.xsd"> > <xsl:apply-templates/> > </xsl:element> > </xsl:template> > > <xsl:template match="S"> > <xsl:element name="s" use-attribute-sets="sAttributes" /> > </xsl:template> > > <xsl:attribute-set name="sAttributes"> > <xsl:attribute name="Number"> > <xsl:value-of select="@Number"/> > </xsl:attribute> > <xsl:attribute name="Name"> > <xsl:value-of select="@Name"/> > </xsl:attribute> > <xsl:attribute name="DateLoaded"> > <xsl:value-of select="u[@DateLoaded]"/> > </xsl:attribute> > <xsl:attribute name="State" > > <xsl:value-of select="@State"/> > </xsl:attribute> > </xsl:attribute-set> > > Thanks for your help. > J > > | ![]() | ![]() | ![]() |
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | |||||
|
