Ticket #494 (closed question: fixed)

Opened 4 years ago

Last modified 4 years ago

Ref contraction with default XSLT?

Reported by: cmueller Owned by: dmisev
Priority: minor Milestone: Release v0.1.3
Component: XSLT Version: v0.1.3
Keywords: Cc: vzholudev, dmisev, kohlhase, clange
Blocked By: Blocking:
Due to close: Include in GanttChart: no
Dependencies: Due to assign:

Description

Do the JOMDoc default XSLT initialise the contraction of ref-elements?

When calling jomdoc transform -X exam08-ref.omdoc with the below input file:

<?xml version="1.0"?>
<omdoc xmlns="http://omdoc.org/ns" xmlns:dc="http://purl.org/dc/elements/1.1/">
	<theory xml:id="exam08-ref.t">
		<import from="graph/en/graph.omdoc#graph.t" />
		<import from="graph/en/tree.omdoc#tree.t" />
		<import from="graph/en/fun.omdoc#fun.t" />
		<tgroup layout="section">
			<metadata>
				<dc:title>Graphs</dc:title>
			</metadata>
			<ref xref="./graph/problems/graph1.omdoc#graph1.ex" />
		</tgroup>
		<tgroup layout="section">
			<metadata>
				<dc:title>Trees</dc:title>
			</metadata>
			<ref xref="./tree/problems/tree1.omdoc#tree1.ex" />
		</tgroup>
		<tgroup layout="section">
			<metadata>
				<dc:title>Function</dc:title>
			</metadata>
			<ref xref="./fun/problems/fun1.omdoc#fun1.ex" />
		</tgroup>
	</theory>
</omdoc>

The output is as follows

<?xml version="1.0" encoding="UTF-8"?>
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <link rel="stylesheet" type="text/css" href="omdoc-default.css"/>
    <title/>
  </head>
  <body>
    <div class="theory" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:dc="http://purl.org/dc/elements/1.1/">
      <div class="omdoc-tgroup">
        <h2>1. Graphs</h2>
      </div>
      <div class="omdoc-tgroup">
        <h2>1. Trees</h2>
      </div>
      <div class="omdoc-tgroup">
        <h2>1. Function</h2>
      </div>
    </div>
  </body>
</html>

Is this right? I thought that at some point in time the XSLT did flatten a document automatically. How is this currently done for the JOBAD demo?

Thanks a lot in advance!

Change History

follow-ups: ↓ 3 ↓ 9   Changed 4 years ago by clange

You are right, but it's only done for <ref type="include">. According to the OMDoc spec, there is one more type (cite), where you certainly wouldn't want flattening, and all other types of ref (or no type) are unspecified or application-specifc.

  Changed 4 years ago by cmueller

  • priority changed from major to minor

in reply to: ↑ 1 ; follow-up: ↓ 4   Changed 4 years ago by cmueller

  • status changed from new to closed
  • resolution set to fixed

Replying to clange:

You are right, but it's only done for <ref type="include">. According to the OMDoc spec, there is one more type (cite), where you certainly wouldn't want flattening, and all other types of ref (or no type) are unspecified or application-specifc.

Ah I forgot, thank you.

in reply to: ↑ 3 ; follow-up: ↓ 5   Changed 4 years ago by cmueller

  • status changed from closed to reopened
  • resolution fixed deleted

Replying to cmueller:

Replying to clange:

You are right, but it's only done for <ref type="include">. According to the OMDoc spec, there is one more type (cite), where you certainly wouldn't want flattening, and all other types of ref (or no type) are unspecified or application-specifc.

Ah I forgot, thank you.

I am very sorry to bother you again, but I don't get the ref contraction to work using JOMDoc's default XSLTs.

I try to convert:

<?xml version="1.0"?>
<omdoc xmlns="http://omdoc.org/ns" xmlns:dc="http://purl.org/dc/elements/1.1/">
	<theory xml:id="exam08-ref.t">
		<import from="graph/en/graph.omdoc#graph.t" />
		<import from="graph/en/tree.omdoc#tree.t" />
		<import from="graph/en/fun.omdoc#fun.t" />
		<tgroup layout="section">
			<metadata>
				<dc:title>Graphs</dc:title>
			</metadata>
			<ref type="include" xref="#graph1.ex" />
		</tgroup>
		<omtext xml:id="graph1.ex"></omtext>
	</theory>
</omdoc>

and get the following exception

Processing included Document d19e10 (xref graph1.ex) ...
Recoverable error on line 124
  FODC0002: java.net.MalformedURLException

If it is working, how do you deal with the duplicated xml:id?

I also don't get it to work for references to other documents. What would be a proper reference to "test-con.omdoc#graph1.ex"? Should I prepend "./", i.e., use "./test-con.omdoc#graph1.ex"? I am asking as we should keep this consistent for the ref-contraction in JOMDoc. It currently prepends "./".

Many thanks in advance.

in reply to: ↑ 4 ; follow-up: ↓ 6   Changed 4 years ago by clange

  • cc clange added
  • owner changed from clange to dmisev
  • status changed from reopened to new

Replying to cmueller:

I am very sorry to bother you again, but I don't get the ref contraction to work using JOMDoc's default XSLTs.

The XSLTs are OK, the problem is due to #461 (wrong resolution of URIs in XSLTUtil). For now please try by explicitly passing the XSLT with -x.

I also don't get it to work for references to other documents. What would be a proper reference to "test-con.omdoc#graph1.ex"? Should I prepend "./", i.e., use "./test-con.omdoc#graph1.ex"?

No, that's not necessary. I don't have a test case for that (is there one?), but I suspect that the URI resolution also goes wrong here, most likely because it ignores the base URI.

I am asking as we should keep this consistent for the ref-contraction in JOMDoc. It currently prepends "./".

Prepending ./ does not do any harm, but IMHO it's not nice that the ref-contraction outputs it by default.

in reply to: ↑ 5 ; follow-up: ↓ 7   Changed 4 years ago by cmueller

Replying to clange:

Replying to cmueller:

I am very sorry to bother you again, but I don't get the ref contraction to work using JOMDoc's default XSLTs.

The XSLTs are OK, the problem is due to #461 (wrong resolution of URIs in XSLTUtil). For now please try by explicitly passing the XSLT with -x.

Sorry, I didn't remember. it is working now. Thank you.

Prepending ./ does not do any harm, but IMHO it's not nice that the ref-contraction outputs it by default.

So do you suggest to change this for ticket:486? that is to leave out the "./"?

in reply to: ↑ 6 ; follow-up: ↓ 8   Changed 4 years ago by clange

Replying to cmueller:

Prepending ./ does not do any harm, but IMHO it's not nice that the ref-contraction outputs it by default.

So do you suggest to change this for ticket:486? that is to leave out the "./"?

It's a matter of taste anyway, but I think without ./ the output is more intuitive for users. So if it is not too much work (it should not), then I'd suggest to change it.

in reply to: ↑ 7   Changed 4 years ago by cmueller

  • status changed from new to closed
  • resolution set to fixed

Replying to clange:

Replying to cmueller:

Prepending ./ does not do any harm, but IMHO it's not nice that the ref-contraction outputs it by default.

So do you suggest to change this for ticket:486? that is to leave out the "./"?

It's a matter of taste anyway, but I think without ./ the output is more intuitive for users. So if it is not too much work (it should not), then I'd suggest to change it.

Okay, great. I'll ask Dimitar to change it.

in reply to: ↑ 1 ; follow-up: ↓ 10   Changed 4 years ago by dmisev

Replying to clange:

You are right, but it's only done for <ref type="include">. According to the OMDoc spec, there is one more type (cite), where you certainly wouldn't want flattening, and all other types of ref (or no type) are unspecified or application-specifc.

If the type is not specified the ref by default is of type "include", you should adapt the XSLT to this.

in reply to: ↑ 9   Changed 4 years ago by clange

Replying to dmisev:

If the type is not specified the ref by default is of type "include", you should adapt the XSLT to this.

Oh, yes, you're right -- just fixed that.

Note: See TracTickets for help on using tickets.