I don't want to in the output document to write out the element attribute if the value is missing or is an empty string.
How to do that?
That's in a biztalk mapping.
To suppress an element in the destination, use a value mapping functoid.
connect the element in question to a LOGICAL EXISTENCE functoid.
connect the LOGICAL EXISTENCE functoid to a LOGICAL AND functoid.
connect the element functoid to a NOT EQUALS functoid.
In the NOT EQUALS functoid, set the Condition2 to BLANK.
connect the NOT EQUALS functoid to the LOGICAL AND functoid.
connect the LOGICAL AND functoid to the VALUE MAP functoid.
connect the element to the VALUE MAP functoid.
connect the VALUE MAP functoid to the destination element.
Do these steps in order. The screen shot below should help:
HTH
If you prefer doing the XSLT yourself:
(I'm checking for missing element, empty value, and xsi:nil - delete accordingly if not applicable)
<xsl:choose>
<xsl:when test="not(s0:inElement)
or s0:inElement[normalize-space(.) = '']
or string(s0:inElement/#xsi:nil) = 'true'">
... Default here, e.g. leave this blank,
... or if you want nil then <ns1:outElement xsi:nil="true"/>
</xsl:when>
<xsl:otherwise>
<ns1:outElement>
<xsl:value-of select="s0:inElement/text()" />
</ns1:outElement>
</xsl:otherwise>
</xsl:choose>
Related
Using Jaspersoft Studio 6.4.
I am trying to create a java.util.Collection, with nested type java.lang.String.
I want to populate the collection with the values from my data query: iterate through the values of the Field $F{CostCenter} and add each value to my collection. (My query is a domain query).
I have tried
Creating a collection variable
Incrementing the variable by my CostCenter group
Adding the field value to my variable
<variable name="dls_CCArray" class="java.util.Collection" incrementType="Group" incrementGroup="CCGroup">
<variableExpression><![CDATA[$V{dls_CCArray}.add( $F{costCenterSet.costCenterConcatenated} )]]>
</variableExpression>
</variable>
But my variable is null, even though i know my query is returning cost centers.
Reason I need to do this: I have an optional input control. When i select no cost centers, i still need to pass the list of cost center values returned by the query to my next report through my hyperlink parameter.
Thanks in advance
You can use a second variable to add the value to the collection variable. Also, since the engine might evaluate variable expressions more than once, it would be safer to collect the values in a Set so that you don't end up with duplicate values.
Therefore you could have something like this:
<variable name="Values" class="java.util.Set" calculation="System">
<initialValueExpression>new java.util.HashSet()</initialValueExpression>
</variable>
<variable name="ValueAdd" class="java.lang.Boolean">
<variableExpression>$V{Values}.add($F{costCenterSet.costCenterConcatenated})</variableExpression>
</variable>
I created word constraint on element repository
<constraint name="repository">
<word>
<element ns="http://lmpublishlearning.com" name="repository"/>
</word>
</constraint>
we have some document in which element repository value is blank like
<lmp:repository/>
Now in our search application how I can pass above type to get blank value document with word constraint. I try below different case but not able to get result.
rs:q=repository:''&rs:pageLength=10&rs:start=1&rs:sort=relevance"
rs:q=repository:""&rs:pageLength=10&rs:start=1&rs:sort=relevance"
It might meet your requirements to write a custom constraint:
http://docs.marklogic.com/guide/search-dev/search-api#id_97085
that returns
a cts:element-word-query on a tagged value that's not empty
a cts:element-value-query on a tagged value that is empty
Hoping that helps,
I have an incoming schema that looks like this:
<Root>
<ClaimDates005H>
<Begin>20120301</Begin>
<End>20120302</End>
</ClaimDates005H>
</Root>
(there's more to it, this is just the area I'm concerned with)
I want to map it to a schema with a repeating section, so it winds up like this:
<Root>
<DTM_StatementFromorToDate>
<DTM01_DateTimeQualifier>Begin</DTM01_DateTimeQualifier>
<DTM02_ClaimDate>20120301</DTM02_ClaimDate>
</DTM_StatementFromorToDate>
<DTM_StatementFromorToDate>
<DTM01_DateTimeQualifier>End</DTM01_DateTimeQualifier>
<DTM02_ClaimDate>20120302</DTM02_ClaimDate>
</DTM_StatementFromorToDate>
</Root>
(That's part of an X12 835, BTW...)
Of course in the destination schema there's only a single occurrence of DTM_StatementFromorToDate, that can repeat... I get that I can run both Begin and End into a looping functoid to create two instances of DTM_StatementFromorToDate, one with Begin and one with End, but then how do I correctly populate DTM01_DateTimeQualifier?
Figured it out, the Table Looping functoid took care of it.
I'm trying to construct XQuery that will return the count of the number attributes found that have a value of x.
This is part of SQL query and these counts will fill one of the columns returned (that part I can figure out, it's the actual XQuery to get the count I haven't figured out yet.)
For example, if I have <element elementattribute=1>...</element>, how would I count all the #elementattributes that equal 1 for a given chunk of XML?
you can use an asterisk wildcard for the element name:
count(//*[#elementattribute='1'])
Hope that helps...
I have a schema that is the souce with an element that is unbounded. I have a similar element on the destination schema that is also unbounded. I'm trying to figure out how in the map I can ignore the first instance in the source map?
Connect the unbounded source record to an 'Iteration' functoid.
Connect the 'Iteration' to a 'Greater Than' functoid. Add a '1' as input paramter.
Connect the result of the 'Greater Than' to the unbounded record in the destination.