|
next
|
Subject: non breaking space in element breaking my stylesheet Author: Dana Pearson Date: 10 Feb 2014 04:03 PM
|
I created a stylesheet that can be used with a XML file that has been converted from an MS Excel spreadsheet. My client does the spreadsheet conversion.
One of the created XML elements is called bisacsubjectcode. The client has sent me a file that breaks portions of my stylesheet with respect to this element.
Some of these elements contain non breaking spaces,   and sometimes an additional normal space, ie, 20; sometimes at the start of the string, sometimes at the end. Only a dozen or so in a file of 140 or so.
It didn't seem a difficult problem. But using strip-space element=bisacsubjectcode does not work.
I then created a character map to replace the   with nothing.
The   is not in the output but it still subverts the object of my constructor. It seems to still effect using substring function.
<xsl:for-each select="bisacsubjectcode">
<datafield tag="072" ind1=" " ind2="7">
<subfield code="a">
<xsl:value-of select="normalize-space(substring(.,1,3))"/>
</subfield>
<subfield code="x">
<xsl:value-of select="normalize-space(substring(.,4,6))"/>
</subfield>
<subfield code="2">bisacsh</subfield>
</datafield>
</xsl:for-each>
Result where two non break spaces at beginning of the string:
<datafield tag="072" ind1=" " ind2="7">
<subfield code="a">F</subfield>
<subfield code="x">IC0270</subfield>
<subfield code="2">bisacsh</subfield>
</datafield>
original element:
<bisacsubjectcode> FIC027020</bisacsubjectcode>
I use the content in different ways, sometimes to evaluate and/or use only a portion of the code and sometimes to match the entire code to an external XML file with subject heading text.
Code format is always the same: 3 alphabetical characters followed by 5 digits.
What am I overlooking here. By the way, is   considered white space?
thanks,
Dana Pearson
|
|
|