 |
 |
 |
Answered in microsoft.public.xml. Please do not post independently to
multiple groups.
--
Joe Fawcett (MVP - XML)
http://joe.fawcett.name
"SM" <sony.m.2007@g...> wrote in message
news:c7d5b55c-c3f5-489f-af5f-3cd3828e7c1f@d......
> Hi,
> My xml sample data as below
>
> <a>
> <b>
> <c test1 ="1">
> <d> ass</d>
> <e name="n1" number="12">
> <row id="0">
> <field name="valuetobetaken" type="string">
> gfghg
> </field>
> <field name="test1" type="string1">
> gfghg
> </field>
>
> </row>
> <row id="1">
> <field name="test2" type="string">
> gfghg
> </field>
> <field name="test3" type="string1">
> gfghg
> </field>
> </row>
> </e>
> </c>
> </b>
> </a>
> I need to take the attribute value of name("valuetobetaken") from
> the element field using xslt
> <c test1 ="1">
> <d> ass</d>
> <e name="n1" number="12">
> <row id="0">
> <field name="valuetobetaken"
>
> my xslt file as below
>
> <?xml version="1.0" encoding="UTF-8" ?>
> <xsl:stylesheet version="1.0"
> xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
> <xsl:output method="xml"/>
> <xsl:template match="/">
> <xsl:variable name="test" select="." />
> <xsl:for-each select ="$test/a/b">
> <xsl:value-of select="c[@test1=1]/d[@name='n1'][@number=12]/row
> [@id=12]/field[@name]">
>
> </xsl:value-of>
> </xsl:for-each>
>
> </xsl:template>
> </xsl:stylesheet>
>
> the output is always coming as blank as below
> <?xml version="1.0" encoding="utf-8"?>
>
> attribute value is missing in the output.
> is there any problem in the select statement of xsl?
> I would like to know, how to take the attribute value, element value
> of field for the above scenario
>
> Thanks,
> Sony
>
|
 | 

|  |
These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.
|  |
| |
 |
 |
 |