[MarkLogic Dev General] Trailing Spaces Removed from Attribute Values--Bug or Feature?

Michael Blakeley michael.blakeley at marklogic.com
Wed Mar 12 07:17:18 PST 2008


I can't speak to the product issue, but is it practical to work around 
this behavior by ending your class attributes with a dummy character? 
For example:

   <topic class="- topic/topic task/task -"/>
     /self::*[contains(@class, ' topic/topic ')]

   => true

DITA attaches meaning to the leading '-' and '+' characters. Will the 
trailing '-' cause problems? If so, could another character be used?

-- Mike

Eliot Kimber wrote:
> Mike Sokolov wrote:
>>   Agreed; however it's not clear that trailing whitespace needs to be 
>> preserved in order to be able to search for DITA tokens, as in the 
>> original example.  I guess it might depend on just what the tokens 
>> consist of but a word- or phrase-search might be able to make use of the 
>> implicit tokenization done by the indexer without the need for the 
>> trailing whitespace.
>>
>> EG:  cts:attribute-word-search(..."topic/topic") ought to match 
>> "topic/topic" and not match "mytopic/topic-foo", I think.
>>
> 
> It's not just a question of what will work from a MarkLogic query but 
> what consumers of the elements brought out of MarkLogic will get. For 
> example, the XSLT pattern for processing DITA content is:
> 
> <xsl:template match="*[contains(@class, ' topic/topic ')]">
> 
> If I get stuff out of MarkLogic and hand it to an XSLT transform (e.g., 
> the DITA Open Toolkit) then the above match would fail for generic 
> topics (because the literal value of class= would be "- topic/topic" not 
> "- topic/topic ").
> 
> Likewise, editors and other tools that expect the trailing space in 
> order to bind behavior to elements would fail.
> 
> So even in the best case it would be necessary to moderate any element 
> extraction through a filter that either removes the class= attributes 
> entirely (falling back on the schema- or DTD-defined defaults, assuming 
> the DTD or schema association is restored or maintained in the result) 
> or that adds the missing trailing space to the literal class= values in 
> the instance.
> 
> Cheers,
> 
> Eliot
> 

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 5329 bytes
Desc: S/MIME Cryptographic Signature
Url : http://xqzone.marklogic.com/pipermail/general/attachments/20080312/42fd8182/smime.bin


More information about the General mailing list