W3C home > Mailing lists > Public > xproc-dev@w3.org > October 2012

RE: toggling the value of an attribute on a substep based on a passed in option

From: Toman, Vojtech <vojtech.toman@emc.com>
Date: Mon, 15 Oct 2012 03:12:31 -0400
To: XProc Dev <xproc-dev@w3.org>
Message-ID: <F3C7EBECE80AC346BE4D1C5A9BB4A41F2EE73E3371@MX11A.corp.emc.com>
Hi David,

try:

...
<p:validate-with-relax-ng
  name="xmlvalidate"
  assert-valid="true">
  <p:with-option name="dtd-id-idref-warnings" select="$dtd-id-idref-warnings">
    <p:empty/>
  </p:with-option>
  <p:input port="source">
    <p:pipe step="main" port="source"/>
  </p:input>
  <p:input port="schema">
    <p:pipe step="main" port="schema"/>
   </p:input>
</p:validate-with-relax-ng>
...

Regards,
Vojtech

--
Vojtech Toman
Consultant Software Engineer
EMC | Information Intelligence Group
vojtech.toman@emc.com
http://developer.emc.com/xmltech

> -----Original Message-----
> From: David Cramer [mailto:david@thingbag.net]
> Sent: Saturday, October 13, 2012 4:19 PM
> To: XProc Dev
> Subject: toggling the value of an attribute on a substep based on a
> passed in option
> 
> Hi there,
> So I'd like to achieve the effect of doing something like the
> following, where I pass in dtd-id-idref-warnings as an option and then
> use the value of the passed in option to toggle the value of the
> attribute
> dtd-id-idref-warnings: dtd-id-idref-warnings="${dtd-id-idref-
> warnings}".
> But that's clearly the wrong way to do it.
> 
> <p:declare-step version="1.0"
>         xmlns:p="http://www.w3.org/ns/xproc"
>         xmlns:l="http://xproc.org/library"
>         type="l:validate-transform"
>         name="main">
>         <p:option name="dtd-id-idref-warnings" select="'true'"/>
> 
> ...
> 
> <p:validate-with-relax-ng
>   name="xmlvalidate"
>   assert-valid="true"
>   dtd-id-idref-warnings="${dtd-id-idref-warnings}">
>   <p:input port="source">
>     <p:pipe step="main" port="source"/>
>   </p:input>
>   <p:input port="schema">
>     <p:pipe step="main" port="schema"/>
>    </p:input>
> </p:validate-with-relax-ng>
> 
> I've also tried doing a choose/when with a validate-with-relax-ng in
> each branch, but then there are problems with the visibility of the
> result port from xmlvalidate.
> 
> So what's the right way to achieve this? I could have two complete
> different versions of the step, but I was hoping there was a more
> elegant way.
> 
> Thanks,
> David
> 
Received on Monday, 15 October 2012 07:13:17 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 15 October 2012 07:13:17 GMT