Thank you Ryan and Mary

Sadly it didn’t work as I wished for, I still get duplicate uris which is what 
the if statement was introduced to remove….
XSLT-DUPRESULTURIS: (err:XTDE1490) <xsl:result-document href="out/{ $id }.xml" 
method="xml" indent="yes”> </xsl:result-document> -- Two final trees cannot 
have the same URI: out/36CD63C6006FE011A8EE9FEB54B1132A.xml

I have not yet understood completely in what ways it’s possible to read and 
manipulate the result tree in xslt, if I only could address that I would be 
able to see if a specific id was in the result tree and then not process.
But as it stands now I think I have to rethink how I can make sure to only 
process each image once even thou its reoccurring in the source xml.
Thanks anyway
/Erik Zander
Från: Ryan Dew [mailto:[email protected]]
Skickat: den 28 juli 2014 17:20
Till: MarkLogic Developer Discussion
Ämne: Re: [MarkLogic Dev General] XSLT check if result document has been created

I believe you should be able to do something like the following to get what you 
want:

<xsl:template match="//db:informalfigure[descendant::db:imagedata and 
@role='figure']">



        <xsl:variable name="curImage" 
select="substring-after(.//@fileref,'/')"/<mailto:.//@fileref,'/')%22/>>

        <xsl:variable name="id" 
select="$imageMetaData//image[name=string-join(($curISBN,$curImage),'/')]/id"/>
        <xsl:if 
test="not(doc-available(xdmp:resolve-uri(string-join(('out/',$id,'.xml'),''),xdmp:node-uri(.))))">
   <!--This check fails, am I doing it incorrectly or is it the way xslt 
processes document that makes it hard to check if the id have been encountered 
before?-->

            <xsl:result-document method="xml" href="out/{$id}.xml" indent="yes">

On Mon, Jul 28, 2014 at 9:08 AM, Mary Holstege 
<[email protected]<mailto:[email protected]>> wrote:

I think you may be running afoul of URI resolution.
Since the URI you are giving to doc-available is a relative
URI, it will be resolved relative to the static base URI, which
per XSLT is the URI of the stylesheet itself.

//Mary

On Mon, 28 Jul 2014 07:58:04 -0700, Erik Zander
<[email protected]<mailto:[email protected]>> 
wrote:

> Hi All
>
> I’m working on an xslt transform where I’m extracting data about images
> from a document and put
> that data into result document, It all works fine except for when the
> same image occurs more than once as I then get conflicting uris,
>
> my code looks like this
> <xsl:template match="//db:informalfigure[descendant::db:imagedata and
> @role='figure']">
>
>
>
>         <xsl:variable name="curImage"
> select="substring-after(.//@fileref,'/')"/<mailto:.//@fileref,'/')%22/>>
>
>         <xsl:variable name="id"
> select="$imageMetaData//image[name=string-join(($curISBN,$curImage),'/')]/id"/>
>         <xsl:if
> test="not(doc-available(string-join(('out/',$id,'.xml'),'')))">
> <!--This check fails, am I doing it incorrectly or is it the way xslt
> processes document that makes it hard to check if the id have been
> encountered before?-->
>
>             <xsl:result-document method="xml" href="out/{$id}.xml"
> indent="yes">
>
> Ideally I would like to be able to check if the result document have
> been created or not and after that decide if I want to update it with
> more information or just leave it be.
>
> Would appreciate any help on the subject
>
> Best regards
> Erik

--
Using Opera's revolutionary email client: http://www.opera.com/mail/
_______________________________________________
General mailing list
[email protected]<mailto:[email protected]>
http://developer.marklogic.com/mailman/listinfo/general

_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to