Skip to Main Content

Database Software

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

XPath max function

David2005Nov 15 2006 — edited Nov 15 2006
Hi all,

I'm a beginner working with XPath expressions.

I have a xml document 'test.xml' with the following contents.
<?xml version="1.0" encoding="UTF-8"?>
<ICRI xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.orswegimoarmada.es/ORSWE/ICRI
http://www.orswegimoarmada.es/ORSWE/XSD/ICRI/ICRI.xsd"
xmlns="http://www.orswegimoarmada.es/ORSWE/ICRI">
<ID>ICRI.Prueba.DocPrueba1.2006.11.15-09.19.01</ID>
<NombreRecurso>DocPrueba1</NombreRecurso>
<TipoRecurso>Documento Técnico</TipoRecurso>
<Descripcion>Documento de ejemplo.</Descripcion>
<ExtensionRecurso/>
<VersionRecurso>1.0</VersionRecurso>
<Estado>En Proceso</Estado>
<NivelSeguridad>NATO UNCLASSIFIED</NivelSeguridad>
<Entornos/>
<PalabrasClave/>
<Sinonimos/>
<Modificaciones>
<Modificacion>
<Usuario>demoadminpro</Usuario>
<FechaHora>2006.11.15-09.19.01</FechaHora>
<Secuencia>1</Secuencia>
<EnlaceRecurso>/ORSWE/Proyectos/Prueba/Documento Técnico/DocPrueba1.2006.11.15-09.19.01.xml</EnlaceRecurso>
</Modificacion>
<Modificacion>
<Usuario>demoadminpro</Usuario>
<FechaHora>2006.11.15-09.20.01</FechaHora>
<Secuencia>2</Secuencia>
<EnlaceRecurso>/ORSWE/Proyectos/Prueba/Documento Técnico/DocPrueba1.2006.11.15-09.20.01.xml</EnlaceRecurso>
</Modificacion>
<Modificacion>
<Usuario>demoadminpro</Usuario>
<FechaHora>2006.11.15-09.21.01</FechaHora>
<Secuencia>3</Secuencia>
<EnlaceRecurso>/ORSWE/Proyectos/Prueba/Documento Técnico/DocPrueba1.2006.11.15-09.21.01.xml</EnlaceRecurso>
</Modificacion>
</Modificaciones>
</ICRI>

I use the code to obtain information about xml.
SELECT extractValue(value(d), '/ICRI/NombreRecurso', 'xmlns="http://www.orswegimoarmada.es/ORSWE/ICRI"') NOMBRERECURSO,
       extractValue(value(d), '/ICRI/TipoRecurso', 'xmlns="http://www.orswegimoarmada.es/ORSWE/ICRI"') TIPORECURSO,
	   extractValue(value(d), '/ICRI/VersionRecurso', 'xmlns="http://www.orswegimoarmada.es/ORSWE/ICRI"') VERSIONRECURSO,
	   extractValue(value(d), '/ICRI/Descripcion', 'xmlns="http://www.orswegimoarmada.es/ORSWE/ICRI"') DESCRIPCION,
	   extractValue(value(d), '/ICRI/Modificaciones/Modificacion/Secuencia', 'xmlns="http://www.orswegimoarmada.es/ORSWE/ICRI"') SECUENCIA
FROM RESOURCE_VIEW r, table(xmlsequence(extract(r.res, '/r:Resource/r:Contents/i:ICRI', 'xmlns:r="http://xmlns.oracle.com/xdb/XDBResource.xsd" xmlns:i="http://www.orswegimoarmada.es/ORSWE/ICRI"'))) d
WHERE r.any_path='test.xml'
But the element Secuencia has several values and I only need to obtain the max of this values. I think, XPath max function can resolve this issue, but I don't know how do I do this?. Is it possible?

Thanks in advance,
David.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 13 2006
Added on Nov 15 2006
7 comments
2,003 views