you are correct, I should have said: <xsl:template match="doc"> <ID NewID="{str[@name='id']}".../> </xsl:template>
On Thu, Jul 23, 2015, at 10:15 AM, Sreekant Sreedharan wrote: > Well, if you had a result say: > ... > <doc> > <str name="id">589587B2B1CA4C4683FC106967E7C326</str> > <str name="ar">EE3YYK</str> > <int name="age">31034</int> > </doc> > ... > > applying the template: > > <xsl:template match="doc"> > <ID NewID="{@id}" ... /> > </xsl:template> > > > would result in the following XML: > > <IMAGES> > <ID NewID=""/> > </IMAGES> > > This is because 'id' is not an attribute of 'doc'. It is not even the > attribute of doc/str. It is a value of doc/str/@name. But the problem is > that > 1) doc/str/@name can refer to either 'id', or 'ar' and > 2) if the attribute is 'age' then the referred values is not > doc/str/@name, > but doc/int/@name > > Is there a simpler way to work with this? > > > > > > > -- > View this message in context: > http://lucene.472066.n3.nabble.com/XSLT-with-maps-tp4218518p4218761.html > Sent from the Solr - User mailing list archive at Nabble.com.