sc:annotations( [$arg as schema-component()] ) as element()*
Returns the schema annotations of the component, if any. The context item is used if no argument is given.
Annotations will only be returned for schemas that have preservation of them enabled with the "xdmp-annotations" processing instruction. The annotations returned will only include the appinfo children of the annotations unless the schema has the "all" parameter set in the "xdmp-annotations" processing instruction.
Parameters | |
---|---|
arg | The item whose annotations are to be returned. |
<?xdmp-annotations?> <!-- Preserve annotations --> <?xdmp-annotations all?> <!-- Preserve documentation annotations -->
(: Get the annotations on the element declaration for the first child of the root of the document "example.xml". Look in those annotations for the app:hidden element and get its value. The element declaration might have a declaration that includes: <xs:annotation> <xs:appinfo> <app:hidden xmlns="http://example.com/appinfo">false</app:hidden> <app:default xmlns="http://example.com/appinfo">47</app:default> </xs:appinfo> </xs:annotation> :) declare namespace ex="http://example.com/dummy"; declare namespace app="http://example.com/appinfo"; fn:data(doc("example.xml")/ex:root/element()[1] /sc:element-decl()!sc:annotations()//app:hidden) => false()
Stack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.