How do I override upper-case of @href in my keyref document?

I'm setting up a keyref to map href paths for xref linking.  However, SDL converts the @href entry to uppercase.  The output creates a URL that is all upper-case, which renders the link as invalid.

Now I'm forced to adjust my OT plugin to convert the @href to lowercase.  I can understand (slightly) why SDL does this for an @id but why, why does it insist on doing this for a keyref document, which is strictly used for indirection?

  • Hey Rick,

    You might overcome this issue by tweaking the IWritePluginConfiguration so that the 'ISHSYSHYPERLINKSTOMETADATA' plugin is seperated for ISHMasterDoc, ISHModules and ISHLibrary objects.

    The default OOTB plugin is something as shown below (copied from our Documentation set)

    ----- OOTB plugin configuration -----

    <plugin name="ISHSYSHYPERLINKSTOMETADATA" handler="BlobExtractHyperlinks"
    ishcondition="CurrentAction in ('Create', 'Update', 'Checkin') and (ISHType in ('ISHMasterDoc', 'ISHModule', 'ISHLibrary') and EDT='EDTXML')">
    <description>Find hyperlinks in document and put them on card</description>
    <workingset>
    <ishfields>
    <ishfield name="FISHHYPERLINKS" level="lng" />
    </ishfields>
    </workingset>
    <initialize>
    <parameters>
    <parameter name="ExtractXPath">
    (//*[contains(@class,' topic/xref ')][@href!='-dita-use-conref-target' or not(@conref)][not(ancestor::*[@conref])][not(ancestor-or-self::*[@scope and @scope!=''][position()=1]/@scope='external')]/@href) | (//*[contains(@class,' topic/link ')][@href!='-dita-use-conref-target' or not(@conref)][not(ancestor::*[@conref])][not(ancestor-or-self::*[@scope and @scope!=''][position()=1]/@scope='external')]/@href) | (//*[contains(@class,' map/reltable ')]//*[contains(@class,' map/topicref ')][@href!='-dita-use-conref-target' or not(@conref)][not(ancestor::*[@conref])][not(ancestor-or-self::*[@scope and @scope!=''][position()=1]/@scope='external')]/@href) | (//*[contains(@class,' map/reltable ')]//*[contains(@class,' map/navref ')][@mapref!='-dita-use-conref-target' or not(@conref)][not(ancestor::*[@conref])][not(ancestor-or-self::*[@scope and @scope!=''][position()=1]/@scope='external')]/@mapref)
    </parameter>
    <parameter name="MetadataField">FISHHYPERLINKS</parameter>
    <parameter name="HyperlinkSeparator">#</parameter>
    <parameter name="MetadataUpperCase">Yes</parameter>
    <parameter name="DocumentUpperCase">Yes</parameter>
    <parameter name="AddObjectRef">Yes</parameter>
    </parameters>
    </initialize>
    </plugin>
    ----- end of plugin configuration -----

    As you can see from this configuration, the hyperlink is turned into UpperCase in the document as well. This is based upon the parameter DocumentUpperCase with the value 'Yes'.

    So separating the definition for ISHMasterDoc and ISHModule from the ISHLibrary based objects might allow you to change the DocumentUpperCase parameter value from Yes to No which should prevent the UpperCase feature in the document.

    Please test this out with caution as it might have some other side effects, I'm currently overlooking.

    Kind Regards,

    Raf
  • Thanks for the response. This suggestion seems too radical for my taste. It affects too many, if not all, attributes of our content. I'll continue to control this from the plugin side.
  • What is the rationale for some of these defaulting to 'YES'? This occasionally causes issues because it can break hrefs. What would be the risks of changing them to 'NO'?

  • In general, choices from the past, and customers that are on a multitude of versions (;-)) that all expect easy and fast upgrades.

    The rest is a bit of logical thinking on this legacy. A lot of metadata is and relies to be case-insensitive - especially the uppercase LogicalId GUIDs. Toggling that creates issue as you suddenly don't have matches anymore.

    Imagine your Windows file system which is case-insensitive suddenly toggling, what would C:\Windows\ do or c:\WINDOWS if suddenly not found/matched anymore in all kinds of configurations and usages?

    Hope this quickie gives some insights.
    Dave

  • Hi Raf,

    I have just come across this which is a problem for a new type of href we want to use within standard topics that has a mix of upper and lower case characters.

    If I do make the change in the Write Plugin, where exactly do I make it (have tried unsuccessfully in ISHSYSHYPERLINKSTOMETADATA) and are there any other updates that need to be run to make it work?

    Any advice appreciated,

    Regards,

    Ann

  • Ann,

    RWS folks will know better than I do, but I think you are on the right track with ISHSYSHYPERLINKSTOMETADATA. The XPath expressions there are really frightening. I think I did manage to change one several years ago in LiveContent Architect, but I don't think I have access to that environment any more.

    So I think you may be able carefully construct a new XPath expression to add to that plugin.

    In Tridion Docs 14, I noticed the comment that you also have to modify the file "TemplateSpecification.xml" when you change the plugin (that file is under InfoShare\Web[*]\Author\ASP\ClientConfig), and in the XML Publish Plugin Settings.

    You could also play with adding @scope=external (if that is valid in your markup) and see if the write plugin preserves your @href case then.

    (newlines added for readability)

    <!-- ======================================================= -->
    <!--
    NOTE: When adapting ExtractXPath of ISHSYSHYPERLINKSTOMETADATA, also adapt
    - parameter 'ExtractHyperlinks' in Admin.XMLPublishPluginConfiguration.xml
    - 'hyperlinktemplates/extractXPath' in TemplateSpecification.xml
    -->
    <plugin name="ISHSYSHYPERLINKSTOMETADATA"
    handler="BlobExtractHyperlinks"
    ishcondition="CurrentAction in ('Create', 'Update', 'Checkin') and (ISHType in ('ISHMasterDoc', 'ISHModule', 'ISHLibrary') and EDT='EDTXML')"
    >
    <description>Find hyperlinks in document and put them on card</description>
    <workingset>
    <ishfields>
    <ishfield name="FISHHYPERLINKS" level="lng" />
    </ishfields>
    </workingset>
    <initialize>
    <parameters>
    <parameter name="ExtractXPath">
    (//*[@href][contains(@class,' topic/xref ')][@href!='-dita-use-conref-target'
    or not(@conref)][not(ancestor::*[@conref])][not(ancestor-or-self::*[@varref])][not(ancestor-or-self::*[@scope
    and @scope!=''][position()=1]/@scope='external')]/@href)
    |
    (//*[@href][contains(@class,' topic/link ')][@href!='-dita-use-conref-target'
    or not(@conref)][not(ancestor::*[@conref])][not(ancestor-or-self::*[@varref])][not(ancestor-or-self::*[@scope
    and @scope!=''][position()=1]/@scope='external')]/@href)
    |
    (//*[contains(@class,' map/reltable ')]//*[@href][contains(@class,' map/topicref ')][@href!='-dita-use-conref-target'
    or not(@conref)][not(ancestor::*[@conref])][not(ancestor-or-self::*[@varref])][not(ancestor-or-self::*[@scope
    and @scope!=''][position()=1]/@scope='external')]/@href)
    |
    (//*[contains(@class,' map/reltable ')]//*[@mapref][contains(@class,' map/navref ')][@mapref!='-dita-use-conref-target'
    or not(@conref)][not(ancestor::*[@conref])][not(ancestor-or-self::*[@varref])][not(ancestor-or-self::*[@scope
    and @scope!=''][position()=1]/@scope='external')]/@mapref)
    </parameter>
    <parameter name="MetadataField">FISHHYPERLINKS</parameter>
    <parameter name="HyperlinkSeparator">#</parameter>
    <parameter name="MetadataUpperCase">Yes</parameter>
    <parameter name="DocumentUpperCase">Yes</parameter>
    <parameter name="AddObjectRef">Yes</parameter>
    </parameters>
    </initialize>
    </plugin>