New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Errors caused by link to topic with xref in shortdesc #3078
Comments
This is probably also related to DITA-OT 2.5.x and to other linking elements like To other crazy people: If you like to avoid problems related to this bug, you may want to use a Schematron rule to prohibit links completely in <sch:pattern id="no-linking-in-shortdesc" see="https://github.com/dita-ot/dita-ot/issues/3078">
<sch:rule context="*[contains(@class, ' topic/shortdesc ')]">
<sch:report test="*[@keyref] or *[contains(@href, '.dita')]">
Do not link to other topics in <shortdesc>. This does not work.
</sch:report>
</sch:rule>
</sch:pattern> |
+1 Same problem when generating the PDF. Similar to your case, console output shows that the target file is searched in a very strange location, instead of being searched in the transformation temporary files folder, it's searched in the place where the XSLT is located:
|
Somewhere in the "topicpullImpl.xsl" there is a document() function using the relative reference to the file. Somehow the "$linkElement" which should be used to retrieve a base URI is a node set which is not part of a document. |
BTW, attached sample project is incomplete, it's missing a "xrefshortdesc\haslink.dita" attaching a complete sample: |
Interesting timing, I just had somebody run into this again yesterday (completely different author / set of content, but same message from |
Think I found the problem, in "topicpullImpl.xsl" there is a variable called "shortdesc" which gets computed and there is an apply-templates on it. But variables no longer have base-uri(). |
Yes - that sounds right. Over the last few years we've had more pieces of code that put elements into variables, and when working on content in the variable the context is lost. |
A possible fix would be to pass an extra parameter as a tunneled parameter:
then pass this extra parameter through the "dita-ot:getTargetElement" function to the "dita-ot:getTargetDoc" function where the "baseContextElement" if available would be used instead of the "$linkElement" parameter in the document() function. |
One more problem is that there is a "move-meta-entries" stage which copies metadata (like shortdesc) from topics to maps. So this stage copies the "shortdesc" from the topic to the map. But the "topicpull" stage is responsible of enriching the shortdesc in the DITA topic to also expand xrefs. |
The question maybe for @jelovirt would be what possible side effects would be if in the build file "plugins\org.dita.base\build_preprocess.xml" in the ""preprocess"" target we would move the call to the "topicpull" stage before the call to the "move-meta-entries" stage. |
I don't think we want to do that, especially with |
As a general overview of this issue, there are two aspects:
|
👍 One more report: again a short description contains an xref, and at some point in the [topicpull] stage we get this error in the console view (using DITA OT 3.3.1):
so the "process_edit.dita" is searched for in the wrong folder. |
@raducoravu do you still have the code set up that used |
I will do this on Monday |
@robander added my changes as a possible pull request, they don't need to be integrated as they are if you have a better solution, it's just for you to know what I did on my side. |
👍 We had another end user asking for a fix for this on DITA OT 2.5.4. |
Attaching the end user's samples for which html5 publishing still reports errors like "The file topic_a.dita is not available to resolve link information." even with my fix applied. Why are the errors still reported? I give up :( |
Probably one more problem. Again, topic is searched for in the wrong folder: |
This issue has been automatically marked as stale because it has not been updated recently. It will be closed soon if no further activity occurs. Thank you for your contributions. |
…e a link in it
* rewriting attestaion.md - will remove dita later * push the file that has error to be discussed in dita group * Workaround issue dita-ot/dita-ot#3078 which prevents SHORTDESC to have a link in it * splitting original attestation.dita into smaller files.
* rewriting attestaion.md - will remove dita later * push the file that has error to be discussed in dita group * Workaround issue dita-ot/dita-ot#3078 which prevents SHORTDESC to have a link in it * splitting original attestation.dita into smaller files.
* rewriting attestaion.md - will remove dita later * push the file that has error to be discussed in dita group * Workaround issue dita-ot/dita-ot#3078 which prevents SHORTDESC to have a link in it * splitting original attestation.dita into smaller files.
* rewriting attestaion.md - will remove dita later * push the file that has error to be discussed in dita group * Workaround issue dita-ot/dita-ot#3078 which prevents SHORTDESC to have a link in it * splitting original attestation.dita into smaller files.
* rewriting attestaion.md - will remove dita later * push the file that has error to be discussed in dita group * Workaround issue dita-ot/dita-ot#3078 which prevents SHORTDESC to have a link in it * splitting original attestation.dita into smaller files.
Expected Behavior
When I have the following condition:
<xref>
to another topicxref-in-shortdesc.dita
<xref>
tofinaltarget.dita
<desc>
The
topicpull
step ends up grabbing the short description from the middle filexref-in-shortdesc.dita
, putting that in a variable, and then processing the variable. The result is that the<xref>
tofinaltarget.dita
is processed again but in the context of that variable, which causes the processor to look for it in our XSLT directory, and ends with errors. Happens with bothpreprocess
andpreprocess2
, here is the error log frompreprocess
:This worked at some point in the past (at least, the
xref
inside shortdesc was processed to get text) but could have been broken as far back as 1.8 -- the text was pulled and no errors were thrown.Actual Behavior
Errors appear as shown above.
preprocess2
has the same issue:Possible Solution
Once everything is in the variable context, I'm not sure how easy it is to get away from this. Most likely, the only way around it is to update the
copy-shortdesc
mode so that when it finds an xref, it actually goes to process the file, but I'm not sure yet.Steps to Reproduce
Samples attached:
xrefshortdesc.zip
Copy of the error message, log file or stack trace
Shown above
Environment
The text was updated successfully, but these errors were encountered: