xml - xsl for function iteration introducing unwanted spaces -
i'm generating xml output using base 'super' xml file , reference xml file list parts of super-file need.
the problem function. when use iterate on set , conditionally output value, keeps outputting spaces no match!
here's code
<xsl:attribute name="type" select=" $index_type in $ref_indexes/@type return (if (translate($index_type, 'abcdefghijklmnopqrstuvwxyz ', 'abcdefghijklmnopqrstuvwxyz') = ./@type) $index_type else '')) "/>
where $ref_indexes/@type
contain
"abc def ghi mno"
and ./@type
single element of
{abc,def,ghi,jkl,mno,pqr}
the result has spaces in attribute, ie:
type="abc..." type=".def.." type="..ghi." type="...mno"
- i have tried using intersect , got this:
"required item type of first operand of 'intersect' node(); supplied value has item type xs:string"
- i've tried
nomalize-space
, got this:
"a sequence of more 1 item not allowed first argument of normalize-space()"
when use
distinct-values
gives me 1 space, frustrating because it's close!i've tried checking result length > 1 also, still spaces. i've tried including space in translation.
fwiw i'm doing transformation on osx (10.6.7) java 1.5.0_26 , saxon 9 he.
i'm pretty out of ideas @ stage :(
all , warmly appreciated,
gary
does
<xsl:attribute name="type" select=" string-join(for $index_type in $ref_indexes/@type return (if (translate($index_type, 'abcdefghijklmnopqrstuvwxyz ', 'abcdefghijklmnopqrstuvwxyz') = ./@type) $index_type else ''), '') "/>
do want? if not consider post minimal complete samples allowing reproduce problem.
[edit] think doing
<xsl:attribute name="type" select="$ref_indexes/@type[translate(., 'abcdefghijklmnopqrstuvwxyz ', 'abcdefghijklmnopqrstuvwxyz') = current()/@type]"/>
might suffice.
Comments
Post a Comment