xml - How to get attribute values if they are not equal to some values? -
i have xml like:
<movies> <movie name="aaa"> ... </movie> <movie name="bbb"> ... </movie> <movie name="ccc"> ... </movie> <movie name="ddd"> ... </movie> <movie name="eee"> ... </movie> </movies>
i name of movie if not 'aaa', or 'bbb', or 'ddd'. output be:
ccc eee
because have several restrictions, don't think it's suitable use 'xsl:if'..i wrote xslt (i'm using xslt 1.0):
<xsl:value-of select="movies/movie/@name[not(self::aaa) , not(self::bbb) , not(self:ddd)]"/>
but compiler complained there syntax error in sentence..and can't figure out why..
so me this? many thanks!!
try xpath expression:
movies/movie[@name!='aaa' , @name!='bbb' , @name!='ddd']/@name
or one:
movies/movie/@name[.!='aaa' , .!='bbb' , .!='ddd']
the latter shorter, former can extended check other return not name, whole <movie>
element - remove /@name
@ end. or if want second, add /..
@ end.
Comments
Post a Comment