J
Jaunedeau
I have some XML that must look like this :
<movies>
<movie id="1">
<actor preferredMovieId="1">
<actor preferredMovieId="2">
<actor preferredMovieId="3">
</movie>
<movie id="2">
<actor preferredMovieId="2">
<actor preferredMovieId="2">
</movie>
<movie id="3">
<actor preferredMovieId="1">
<actor preferredMovieId="1">
<actor preferredMovieId="3">
</movie>
</movies>
I could write the xs:key which seems to work fine :
<xs:element name="movies" >
<xs:complexType >
<xs:sequence>
...
</xs:sequence>
</xs:complexType>
<xs:key name="k_movie">
<xs:selector xpath="./target:definition"/>
<xs:field xpath="@id"/>
</xs:key>
</xs:element>
But I could not get anything right to say that "movie/actor/@id" should
point to a "movie/@id".
I hoped that something like this would work, but it does not :
<xs:keyref name="kr_prefferedMovie_movie" refer="k_movie">
<xs:selector xpath="./target:movie/target:actor"/>
<xs:field xpath="@prefferedMovieId"/>
</xs:keyref>
When trying to validate, an error tells me that the value matched by
k_movie is not matched by the referenced key. The key is matched (it
works if I remove the keyref), so I think the problem is that the
context is not the good one.
Of course, this is a simplified version of my real example, so I may
have introduce typos whiles making it, but I really need a working
example !
Regards,
Fabien.
Of course, this is
<movies>
<movie id="1">
<actor preferredMovieId="1">
<actor preferredMovieId="2">
<actor preferredMovieId="3">
</movie>
<movie id="2">
<actor preferredMovieId="2">
<actor preferredMovieId="2">
</movie>
<movie id="3">
<actor preferredMovieId="1">
<actor preferredMovieId="1">
<actor preferredMovieId="3">
</movie>
</movies>
I could write the xs:key which seems to work fine :
<xs:element name="movies" >
<xs:complexType >
<xs:sequence>
...
</xs:sequence>
</xs:complexType>
<xs:key name="k_movie">
<xs:selector xpath="./target:definition"/>
<xs:field xpath="@id"/>
</xs:key>
</xs:element>
But I could not get anything right to say that "movie/actor/@id" should
point to a "movie/@id".
I hoped that something like this would work, but it does not :
<xs:keyref name="kr_prefferedMovie_movie" refer="k_movie">
<xs:selector xpath="./target:movie/target:actor"/>
<xs:field xpath="@prefferedMovieId"/>
</xs:keyref>
When trying to validate, an error tells me that the value matched by
k_movie is not matched by the referenced key. The key is matched (it
works if I remove the keyref), so I think the problem is that the
context is not the good one.
Of course, this is a simplified version of my real example, so I may
have introduce typos whiles making it, but I really need a working
example !
Regards,
Fabien.
Of course, this is