Re: [Xsltforms-support] Namespace issue (not quite newbie)...
Brought to you by:
alain-couthures
|
From: Ralph C. <ra...@ra...> - 2021-12-05 21:02:59
|
Thanks so much, Habs! Slightly different behaviour on my set up to
yours, in that I had to prefix each element in the Xpath (so
ref="my:person/my:persName/my:forename") but that's doable. You're
absolutely right about the dummy namespace: I can't think of any reason
why that would be a useful feature to introduce.
Anyway, problem solved - onto the next one.
Thanks again
Ralph
On 05/12/2021 19:22, Habs wrote:
> On Sun, 5 Dec 2021, Ralph Corrigan wrote:
>
> Hi all, You were kind enough to help me earlier in the year when I was looking
> at xsltforms for the first time, and things have moved a long way from
> there. But I'm hitting a problem going back through the documents and
> forms trying to make them conformant with TEI (not my choice, because
> we're not actually encoding text, but anyway). These problems arose
> early on, so I removed it and ran everything through the empty namespace
> (xmlns="").
> So target (e.g.) is:
>
> <TEI xmlns=""> ....................
> <listPerson/>
> </TEU>
>
> And the instance that populates it is:
>
> <xf:instance id"XX">
> <items xmlns="">
> <listPerson/>
> </items>
> </xf:instance>.
>
> On the form itself, the input fields all use the xf: prefix, so
> <xf:input ref="instance('XX')/listPerson/person"> etc. An xquery POST
> then inserts the instance data (using request:get-data()/*) into the
> original xml document.
>
> This all works absolutely fine and does everything I would expect it to.
>
> However, if I change the namespace in the instance to <items
> xmlns="http://www.tei-c.org/ns/1.0"> [1] the xf:input fields no longer
> render. Try as I might, wherever I put the namespace declaration on the
> form (and even if I add it to the xsltforms.xsl) the fields no longer
> render. I have noticed that there is no reference to the TEI namespace
> in the finally generated header, which I'#m guessing could be the
> problem, but I've no idea how to get it there:
>
> <html xmlns:xalan="http://xml.apache.org/xalan"
> xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
> xmlns:xsd="http://www.w3.org/2001/XMLSchema"
> xmlns:dcterms="http://purl.org/dc/terms/"
> xmlns:ajx="http://www.ajaxforms.net/2006/ajx"
> xmlns:txs="http://www.agencexml.com/txs"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><!--HTML elements
> generated by XSLTForms 1.5.5 (661) - Copyright (C) 2021 <agenceXML> -
> Alain Couthures - http://www.agencexml.com-->.
>
> I thought I'd be able to work around it by calling a src instance from
> the main TEI namespace xml document, but this runs into the same
> problem.
>
> Any ideas about how I get round this (or do it properly in the first
> place)!
> If not sorted yet, please will you by reply, attach the smallest complete xform and any instance(s) that are not working as you'd expect.
>
> I'm not a 'namespace' guru, but namespaces I find can be quite testing.
>
> Thank you
> Habs
>
> --- Sent using Alpine/Pine, probably the best MUA ---
>
> My Tox Messaging Id:
> 9F10AC64260ADEBAEA017ACB71B7CD2E962596FC4293025C0F79D77FFEB4CE5C7B0BED41D925
> Get a client here: https://tox.chat/clients.html
On Sun, 5 Dec 2021, Ralph Corrigan wrote:
> Thanks for getting back to me, Habs:
>
> So a short illustrative example attached. This form works fine in
> exist-db, and I've declared tei in the html header (although clearly
> there is nothing prefixed with 'tei'), all good. But as soon as I try
> and apply the tei namespace to the listPerson instance (I've tried
> adding it everywhere), the form fields no longer render (and don't
> appear to be loaded at all). I've tried adding the tei prefix to the
> instance, the form fields and both at the same time, but still not got
> anywhere yet...
>
> Any suggestions gratefully received!
>
> Cheers
> Ralph
Please see attached.
A little tip I learned a long time ago for xhtml forms and namespaces,
was to use two additional ones ... I cannot for the life in me,
remember why ! If it's obvious to you let me know please.
I think it has something to do with clashes between [default] xform
namespaces and other namespaces in the instance(s).
I've edited your example and it is sorted now on my setup. Note the
xmlns:my and my:dummy additions, the xmlns in the instance and the
changes using my: in the form.
Hopefully that answers your need.
Regards
Habs
--- Sent using Alpine/Pine, probably the best MUA ---
My Tox Messaging Id:
9F10AC64260ADEBAEA017ACB71B7CD2E962596FC4293025C0F79D77FFEB4CE5C7B0BED41D925
Get a client here: https://tox.chat/clients.html |