collapse bookmarks by default in dita 1.8.4 - pdf

i have a working customization, but what i cannot figure out is, how to set the bookmarks in my pdf document to 'collapsed' by default.
i tried to paste
<property name="args.bookmark.style" value="COLLAPSED" />
into my build file, as well as into build.xml, build_template.xml and build.properties in the plugin and customization folder.
Nothing seems to have an effect on this.
Am i missing a step?
(I have been wondering if there was something in my customization which would automatically leave the bookmarks expanded, but I do not know where to look for this... I am pretty sure this is not the problem)
Thanks in advance!

If you look in this XSLT stylesheet:
DITA-OT/plugins/org.dita.pdf2/cfg/fo/attrs/basic-settings.xsl
there is a parameter called "bookmarkStyle" which gets its value from the ANT build files.
<xsl:param name="bookmarkStyle">
<xsl:choose>
<xsl:when test="$antArgsBookmarkStyle!=''"><xsl:value-of select="$antArgsBookmarkStyle"/></xsl:when>
<xsl:otherwise>COLLAPSED</xsl:otherwise>
</xsl:choose>
</xsl:param>
As you can see, the default value for that parameter is COLLAPSED so you should do nothing to obtain this default behavior, I tested and the bookmarks area in a generated PDF only shows the top-level topic references.
You can also add an xsl:message in that parameter and see the value it receives from the build files.
Maybe you have another expectation of what args.bookmark.style was intended to be used for.

I finally found out what was the problem.
There was no need to change any ANT properties.
All it needs is to add the following attribute:
<xsl:attribute name="starting-state">hide</xsl:attribute>
in the template:
<xsl:template match="*[contains(#class, ' topic/topic ')]" mode="bookmark">

Related

Why would components in this Blazor app fail to render?

I'm writing a Blazor app and obviously I want to get some components rendered in there. I've just tried adding a basic navigation element to my main layout but it's not rendering. I can see the element on the DOM, but that element is empty.
I went with some fairly simple content to start with in my NavMenu component that I'm trying to include on MainLayout.cshtml:
<h1>WHYYYY????</h1>
I've also taken a pretty simple layout on my MainLayout.cshtml page:
#inherits BlazorLayoutComponent
<NavMenu />
<div class="body-content">
#Body
</div>
The file structure in my project seems uncomplicated:
So I'm at a loss here as to what I've overlooked. It looks like Blazor knows there's something it should be rendering to the page - that's why I can see the NavMenu element in the DOM. But there's never any content rendered inside that element. What's missing?
I'm running the latest (at time of writing) version of Blazor: 0.5.1.
You are probably running into a bug with the .csproj file. It should look like this:
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<RunCommand>dotnet</RunCommand>
<RunArguments>blazor serve</RunArguments>
<LangVersion>7.3</LangVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Blazor.Browser" Version="0.5.1" />
<PackageReference Include="Microsoft.AspNetCore.Blazor.Build" Version="0.5.1" />
<DotNetCliToolReference Include="Microsoft.AspNetCore.Blazor.Cli" Version="0.5.1" />
</ItemGroup>
Yours has most likely extra stuff in it, that prevents the component from compiling. This typically happens when adding files or copying them. See: https://github.com/aspnet/Blazor/issues/1206
It turns out the root cause was related to namespaces and casing.
When I originally set up the project, I created it using the command line in VS Code. Out of habit, I wrote everything in lowercase (i.e. dotnet new blazor -o myapp).
As a personal preference, I like my namespaces to be title cased, so some time later I decided to "tidy up" and change myapp to Myapp. I went through the code to refactor to the new titlecase name and everything compiled, so I carried on working... until a few weeks later when I went back to do some work on a component and noticed it wasn't behaving.
It turns out that razor pages are automatically namespaced based on folders and a subset of those are included in the _ViewImports.cshtml page. That file still referenced the lower case namespace and pages looking for a lowercase project root were no longer able to find the right shared components.
So unsurprisingly, it's an entirely self-inflicted issue and yes I feel very silly for not thinking it through properly from the start.

Storing Non-Visible (But Required) Information in a FlowDocument

I am trying to write a two-way XHTML to FlowDocument (FD) XSLT transformation, and I'm running into a recurring issue - there are things you can do in HTML that don't make sense (at least in this early version) in a FD. For example, XHTML has the notion of an accesskey attribute, but there is no corresponding FD XAML element.
Even though the FD has no use for it, I need a way to store this information in the XAML of the FD so I can retrieve it later. Something along the lines of:
<xsl:template match=#accesskey>
<InvisibleElement name="accesskey" value="." />
</xsl:template>
...but to my knowledge, there is no FD element that doesn't have a corresponding display. I suppose I could use an empty <Span /> or <Run />, but that could lead to issues if someone edits the document and inadvertently adds content where I don't expect it.
Another option might be:
<xsl:template match="#accesskey">
<InlineUIContainer Tag="accesskey">
<TextBlock Visibility="Collapsed" Tag="{.}" />
</InlineUIContainer>
</xsl:template>
Since it wouldn't be visible, it'd be uneditable.
Suggestions?

How to override discovery search results

One of the requirements of the repository I'm working on is to have an Advanced Search option from the user interface. Since as of DSpace 4, the Discovery faceted/filtered search & browse is enabled by default as mentioned here, I just put a link in the navigation to point that Advanced Search link to http://myrepository.org/discover. Now my goal is to suppress the search results whenever the user clicked the Advanced Search link.
How can I override the search results such that if there's no query string (eg if the user goes directly to /discover page and no facets were selected), it will only show like in the picture below without the search results and the Now showing items ... and the pagination divs.
I am using DSpace version 5.3 Mirage 2 Theme
This is what I have tried:
<xsl:template match="dri:list[#id='aspect.discovery.SimpleSearch.list.search-results-repository']">
<xsl:variable name="query-string" select="/dri:document/dri:meta/dri:pageMeta/dri:metadata[#element='request'][#qualifier='queryString']"/>
<xsl:if test="$query-string!=''">
<xsl:apply-templates />
</xsl:if>
</xsl:template>
The code above always suppressed the search results whether I have query strings or not.
EDIT
I have a problem with the template match that I used in my answer. The styling of the sort options was removed.
Can someone help me improve my code such that it will not remove the styling of the sort options? The default sort options should look like this:
I wonder why using that template match removed the styling of the sort options. If I use <xsl:apply-templates/>, or <xsl:apply-templates select="."/> instead of <xsl:copy-of select="."/>, it is not returning the result I want to achieve.
Any advice would be greatly appreciated. Thanks in advance.
After many tries of template match, I finally achieved what I want to display. This is the template match that I am using to achieve my goal.
<xsl:template match="dri:div[#id='aspect.discovery.SimpleSearch.div.search-results']">
<xsl:if test="contains(#pageURLMask,'query') or contains(#pageURLMask,'filter')">
<xsl:copy-of select="."/>
</xsl:if>
</xsl:template>
I don't know and not sure if this is fool proof. I've tested this when going directly to /discover page, no search results displayed and I also tried clicking the search button without entering any values in the search form.
There is a slight problem with this answer. Please see my updated post above.
This is the code that resolved my problems regarding the styling of the sort options.
<xsl:template match="dri:div[#id='aspect.discovery.SimpleSearch.div.search-results']">
<xsl:choose>
<xsl:when test="contains(#pageURLMask,'query') or contains(#pageURLMask,'filter')">
<xsl:apply-templates select="dri:div[#id='aspect.discovery.SimpleSearch.div.masked-page-control']/node()"/>
<xsl:copy>
<xsl:apply-templates select="node()|#*"/>
</xsl:copy>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="no-search-results"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="no-search-results" match="dri:div[#id='aspect.discovery.SimpleSearch.div.masked-page-control']"/>

How do I convert a relative docbook link to a URL?

I am using docbook as a source for HTML and PDF output. In the docbook source, I have a series of links which are relative (pointing to javadoc files), which is fine for the HTML output because the javadoc files are deployed alongside the original document. For the PDF output, I would like to convert these to absolute links by way of prepending a URL prefix. Is this possible? I have added a 'relative' role to these links and have tried adding a fo customization layer:
<xsl:template match="d:link[#role='relative']">
<xsl:copy>
<xsl:attribute name="xlink:href">
<xsl:value-of select="concat('http://prefix/', #xlink:href)"/>
</xsl:attribute>
</xsl:copy>
<xsl:apply-templates select="d:link"/>
</xsl:template>
This seems to half-work in that it does prepend the prefix to the link href, but then it does not convert the link element into FO.
Any ideas, or other ways this could be done?

SharePoint Content Query Web Part question

I'm using CQW to display announcement list. Only problem I'm facing to provide "Add new announcement" button like the one having in Announcement list.Here is my CQW ,
I've tried adding custom "Add new Announcement" link from SharePoint designer. But this solution looks ugly. Can we provide exact button and the interface which default "Add new announcement" link provides ? Please not it's on web part page.
Here is my SPD if someone want to see,
Editing the XSLT can be your solution.
If the repeating is the only thing that stops you from modifying the XSLT, we have to solve that.
You can stop the repeating by using a check on the current position. Only add the link when the position is 1.
Define the current position and use it:
<xsl:param name="CurPos" />
<xsl:if test="$CurPos = 1">
<![CDATA[ Here your link can be placed ]]>
</xsl:if>