<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<div class="moz-cite-prefix">Hello Matt,<br>
<br>
1. The odd line is related to the fact that when validating with a
Schematron file under the hood the Schematron is transformed in
XSLT and that XSLT is applied on the document. The reported error
line is inside that intermediate XSLT and unfortunately I don't
think there is a round trip to get the real location in the
Schematron file.<br>
<br>
2. I believe the NullPointerException is a side effect of the fact
that I didn't consider the fact that the SVG file is also referred
relatively in the DITA document. As a result the SVG will not get
located and parsed by the document() function and later on
exists() function will break. In the example below I've added the
resolve-uri() function to compute the SVG document location.<br>
<br>
3. In the example below I've changed a bit the assert XPath to
ignore the href values that start with 'data'. You should also
take into account the fact that the SVG can contain multiple image
elements. Perhaps you could assert it more elegantly than this but
here a possible solution:<br>
<br>
<schema <br>
xmlns=<a class="moz-txt-link-rfc2396E" href="http://purl.oclc.org/dsdl/schematron">"http://purl.oclc.org/dsdl/schematron"</a> <br>
queryBinding="xslt2"<br>
xmlns:exslt=<a class="moz-txt-link-rfc2396E" href="http://expath.org/ns/file">"http://expath.org/ns/file"</a>><br>
<ns uri=<a class="moz-txt-link-rfc2396E" href="http://expath.org/ns/file">"http://expath.org/ns/file"</a> prefix="exslt"/><br>
<pattern><br>
<rule context="image"><br>
<let name="svgDocument"
value="document(resolve-uri(@href, base-uri()))" /><br>
<let name="svgExists"
value="exists($svgDocument)"/><br>
<assert test="$svgExists">The SVG file can't be
loaded <value-of select="resolve-uri(@href,
base-uri())"/></assert><br>
<br>
<let name="realImages"
value="$svgDocument//*:image/@*:href"/><br>
<!-- If the SVG file can't be loaded or the SVG
points to an embeded image SKIP IT. --><br>
<let name="testImages" value="for $realImage in
$realImages return if (not($svgExists) or starts-with($realImage,
'data')) then true() else exslt:exists(resolve-uri($realImage,
base-uri($svgDocument)))"/><br>
<assert test="empty(index-of($testImages,
false()))">The image file must exist</assert><br>
<br>
</rule><br>
</pattern><br>
</schema><br>
<br>
Best regards,<br>
Alex<br>
<br>
On 30-Jul-13 3:33 PM, KAATMAN Matthew wrote:<br>
</div>
<blockquote
cite="mid:31158_1375187604_51F7B293_31158_459_1_C283C519E1796046AE21A7A1F60882F21599E44094@EXDCVYMBBMR009.eq1bmr.local"
type="cite">
<meta http-equiv="Content-Type" content="text/html;
charset=ISO-8859-1">
<meta name="Generator" content="Microsoft Word 14 (filtered
medium)">
<!--[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]-->
<style><!--
/* Font Definitions */
@font-face
        {font-family:PMingLiU;
        panose-1:2 2 5 0 0 0 0 0 0 0;}
@font-face
        {font-family:"Angsana New";
        panose-1:2 2 6 3 5 4 5 2 3 4;}
@font-face
        {font-family:"Cordia New";
        panose-1:2 11 3 4 2 2 2 2 2 4;}
@font-face
        {font-family:"Cordia New";
        panose-1:2 11 3 4 2 2 2 2 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:"\@PMingLiU";
        panose-1:2 2 5 0 0 0 0 0 0 0;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";
        color:black;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p.MsoPlainText, li.MsoPlainText, div.MsoPlainText
        {mso-style-priority:99;
        mso-style-link:"Plain Text Char";
        margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";
        color:black;}
pre
        {mso-style-priority:99;
        mso-style-link:"HTML Preformatted Char";
        margin:0in;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Courier New";
        color:black;}
p.MsoAcetate, li.MsoAcetate, div.MsoAcetate
        {mso-style-priority:99;
        mso-style-link:"Balloon Text Char";
        margin:0in;
        margin-bottom:.0001pt;
        font-size:8.0pt;
        font-family:"Tahoma","sans-serif";
        color:black;}
span.PlainTextChar
        {mso-style-name:"Plain Text Char";
        mso-style-priority:99;
        mso-style-link:"Plain Text";
        font-family:"Calibri","sans-serif";}
span.BalloonTextChar
        {mso-style-name:"Balloon Text Char";
        mso-style-priority:99;
        mso-style-link:"Balloon Text";
        font-family:"Tahoma","sans-serif";}
span.HTMLPreformattedChar
        {mso-style-name:"HTML Preformatted Char";
        mso-style-priority:99;
        mso-style-link:"HTML Preformatted";
        font-family:"Consolas","serif";
        color:black;}
span.EmailStyle23
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
<div class="WordSection1">
<p class="MsoNormal"><span style="color:#1F497D">Hey Alex,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">This looks
really promising!<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">When I run
validate with this schematron I get the following:<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">System ID:
C:\svn\scripts\svgCheck.sch<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">Engine name:
ISO Schematron (XSLT 2.0)<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">Severity: fatal<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">Type: XML
validation<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">Start location:
149:0 <span style="background:yellow;mso-highlight:yellow">(Odd
because the schematron is only 14 lines)</span><o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">System ID:
C:\dita\pt\products\vitek2systems\pi\Appendix_A.dita <span
style="background:yellow;mso-highlight:yellow">(This is
the first file with an SVG for the document I checked.)</span><o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">Engine name:
ISO Schematron (XSLT 2.0)<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">Severity: error<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">Description:
Exception thrown by extension function {public static
boolean
com.saxonica.functions.extfn.EXPathFile.exists(java.lang.String)}:
java.lang.NullPointerException<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">Type: XML
validation<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">Even if I
delete all SVG references, I receive the above two errors.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">I then tried it
on a map with more SVGs and some that were verified to be
broken. It is properly detecting the errors but I see false
positives when the SVG contains embedded images instead of
linked. I believe it’s trying to verify the binary data as
the uri.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">System ID:
C:\dita\en\products\simon\service\Attachments.dita<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">Engine name:
ISO Schematron (XSLT 2.0)<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">Severity: error<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">Description: A
sequence of more than one item is not allowed as the first
argument of resolve-uri()
(<a class="moz-txt-link-rfc2396E" href="data:image/jpeg;base64,/9j/4AA...">"data:image/jpeg;base64,/9j/4AA..."</a>,
<a class="moz-txt-link-rfc2396E" href="data:image/png;base64,iVBORw0K...">"data:image/png;base64,iVBORw0K..."</a>) <o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">Type: XML
validation<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">Is there a way
for me to adjust the schematron to ignore href values that
start with “data”?<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">I had
previously attended a webinar Oxygen presented on
schematron. I’m finally starting to understand how powerful
it can be!<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">Thank you,<br>
Matt<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<div>
<div style="border:none;border-top:solid #B5C4DF
1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b><span
style="font-size:10.0pt;font-family:"Tahoma","sans-serif";color:windowtext">From:</span></b><span
style="font-size:10.0pt;font-family:"Tahoma","sans-serif";color:windowtext">
<a class="moz-txt-link-abbreviated" href="mailto:oxygen-user-bounces@oxygenxml.com">oxygen-user-bounces@oxygenxml.com</a>
[<a class="moz-txt-link-freetext" href="mailto:oxygen-user-bounces@oxygenxml.com">mailto:oxygen-user-bounces@oxygenxml.com</a>] <b>On Behalf
Of </b>Alex Jitianu<br>
<b>Sent:</b> Tuesday, July 30, 2013 2:25 AM<br>
<b>To:</b> <a class="moz-txt-link-abbreviated" href="mailto:oxygen-user@oxygenxml.com">oxygen-user@oxygenxml.com</a><br>
<b>Subject:</b> Re: [oXygen-user] Feature request:
Validation for linked images in SVG paths<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal">Hello Matt,<br>
<br>
In Oxygen v15.0 we've added in the "Validate and check for
Completeness" dialog a new entry called "Additional
schematron checks" in which you can specify additional
Schematron checks that should be be executed on the topics.
You can perform the check you've described using a
Schematron file with the following content:<br>
<br>
<?xml version="1.0" encoding="UTF-8"?><br>
<schema <br>
xmlns=<a moz-do-not-send="true"
href="http://purl.oclc.org/dsdl/schematron">"http://purl.oclc.org/dsdl/schematron"</a>
<br>
queryBinding="xslt2"<br>
xmlns:exslt=<a moz-do-not-send="true"
href="http://expath.org/ns/file">"http://expath.org/ns/file"</a>><br>
<ns uri=<a moz-do-not-send="true"
href="http://expath.org/ns/file">"http://expath.org/ns/file"</a>
prefix="exslt"/><br>
<pattern><br>
<rule context=<a moz-do-not-send="true"
href="mailto:image[ends-with%28@href,%27.svg%27%29]">"image[ends-with(@href,
'.svg')]"</a>><br>
<let name="svgDocument"
value="document(@href)" /><br>
<assert
test="exslt:exists(resolve-uri($svgDocument//*:image/@*:href,
base-uri($svgDocument)))"><br>
The image file from the following SVG
doesn't exist: <value-of
select="base-uri($svgDocument)"/></assert><br>
</rule><br>
</pattern><br>
</schema><br>
<br>
Best regards,<br>
Alex<br>
-- <br>
Alex Jitianu<br>
<oXygen/> XML Editor, Schema Editor and XSLT
Editor/Debugger<br>
<a moz-do-not-send="true" href="http://www.oxygenxml.com">http://www.oxygenxml.com</a><br>
<br>
<br>
On 29-Jul-13 9:38 PM, KAATMAN Matthew wrote:<o:p></o:p></p>
</div>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<p class="MsoPlainText">Hey Guys,<o:p></o:p></p>
<p class="MsoPlainText"> <o:p></o:p></p>
<p class="MsoPlainText">This is a feature request that's not
extremely crucial, but it would be helpful for us.<o:p></o:p></p>
<p class="MsoPlainText"> <o:p></o:p></p>
<p class="MsoPlainText">I'm having our authors create SVG
overlays and link to the background image (jpeg or png).<o:p></o:p></p>
<p class="MsoPlainText"> <o:p></o:p></p>
<p class="MsoPlainText">Sometimes they accidentally link to an
image that isn't in our repository path.<o:p></o:p></p>
<p class="MsoPlainText"> <o:p></o:p></p>
<p class="MsoPlainText">Within the SVG, I'll end up with
something like:<o:p></o:p></p>
<p class="MsoPlainText"><image width="1200" height="1807"
xlink:href="../../../../../../../Users/Username/Pictures/PREVI
PAV/PAV_printer_cover_open.jpg" ><o:p></o:p></p>
<p class="MsoPlainText"> <o:p></o:p></p>
<p class="MsoPlainText">When it should be:<o:p></o:p></p>
<p class="MsoPlainText"><image width="1200" height="1807"
xlink:href="images/PAV_printer_cover_open.jpg" ><o:p></o:p></p>
<p class="MsoPlainText"> <o:p></o:p></p>
<p class="MsoPlainText">Although, the validate/check for
completeness wouldn't catch this on their workstation as the
image exists and is valid, it would find it quickly on mine
since it's outside the path that gets checked in and I’d be
missing that image.<o:p></o:p></p>
<p class="MsoPlainText"> <o:p></o:p></p>
<p class="MsoPlainText">It doesn't seem like the OT throws any
errors either. The only way I find out is when I'm viewing
the PDF and notice that antenna house has substituted a
broken image.<o:p></o:p></p>
<p class="MsoPlainText"> <o:p></o:p></p>
<p class="MsoPlainText">Example:<o:p></o:p></p>
<p class="MsoPlainText"><img id="Picture_x0020_1"
src="cid:part6.04030306.08000907@sync.ro" height="341"
width="407" border="0"><o:p></o:p></p>
<p class="MsoPlainText"> <o:p></o:p></p>
<p class="MsoPlainText">Thanks!<br>
Matt<o:p></o:p></p>
<p class="MsoNormal"><span
style="font-size:12.0pt;font-family:"Times New
Roman","serif"">AVIS : Ce courrier et ses
pieces jointes sont destines a leur seul destinataire et
peuvent contenir des informations confidentielles
appartenant a bioMerieux. Si vous n'etes pas destinataire,
vous etes informe que toute lecture, divulgation, ou
reproduction de ce message et des pieces jointes est
strictement interdite. Si vous avez recu ce message par
erreur merci d'en prevenir l'expediteur et de le detruire,
ainsi que ses pieces jointes. NOTICE: This message and
attachments are intended only for the use of their
addressee and may contain confidential information
belonging to bioMerieux. If you are not the intended
recipient, you are hereby notified that any reading,
dissemination, distribution, or copying of this message,
or any attachment, is strictly prohibited. If you have
received this message in error, please notify the original
sender immediately and delete this message, along with any
attachments. <br>
<br>
<br>
<o:p></o:p></span></p>
<pre>_______________________________________________<o:p></o:p></pre>
<pre>oXygen-user mailing list<o:p></o:p></pre>
<pre><a moz-do-not-send="true" href="mailto:oXygen-user@oxygenxml.com">oXygen-user@oxygenxml.com</a><o:p></o:p></pre>
<pre><a moz-do-not-send="true" href="http://www.oxygenxml.com/mailman/listinfo/oxygen-user">http://www.oxygenxml.com/mailman/listinfo/oxygen-user</a><o:p></o:p></pre>
</blockquote>
<p class="MsoNormal"><span
style="font-size:12.0pt;font-family:"Times New
Roman","serif""><o:p> </o:p></span></p>
</div>
AVIS : Ce courrier et ses pieces jointes sont destines a leur seul
destinataire et peuvent contenir des informations confidentielles
appartenant a bioMerieux. Si vous n'etes pas destinataire, vous
etes informe que toute lecture, divulgation, ou reproduction de ce
message et des pieces jointes est strictement interdite. Si vous
avez recu ce message par erreur merci d'en prevenir l'expediteur
et de le detruire, ainsi que ses pieces jointes.
NOTICE: This message and attachments are intended only for the use
of their addressee and may contain confidential information
belonging to bioMerieux. If you are not the intended recipient,
you are hereby notified that any reading, dissemination,
distribution, or copying of this message, or any attachment, is
strictly prohibited. If you have received this message in error,
please notify the original sender immediately and delete this
message, along with any attachments.
</blockquote>
<br>
</body>
</html>