When an element has a prefixed lengthKind, then it should be possible to refer, at parse time, to the dfdl:contentLength or dfdl:valueLength of that element.
For complex types, both should be the same, and should be the value of the prefix, adjusted for prefixIncludesPrefixLength (I.e., with that length subtracted if prefixIncludesPrefixLength is 'yes')
This bug report was created as I am unable to get the valueLength or contentLength of a prefixedLength complexType element.
In this specific case, I am trying to do a dfdl:inputValueCalc of an element where the expression refers to dfdl:contentLength(../..), i.e., the enclosing (2 levels up) element, which is of prefixed lengthKind. The purpose of this is because I want an element containing the message length, even though the message length is determined using lengthKind 'prefixed', because I want to check that the message length is greater than or equal to the minimum message length, and not greater than the maximum message length.
These functions can also apply to simpleType elements with lengthKind 'prefixed'. I don't know if they work there or not.
For simple types, the dfdl:contentLength is the value of the prefix, adjusted as just stated. When parsing, the dfdl:valueLength of a simpleType element with representation 'text' is possibly smaller due to dfdl:textTrimKind='padChar' and removal of padding characters. That is, dfdl:valueLength excludes padding and filling for simple types when parsing.