[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] RE: xpath problem
> > <article> som text here <var name="OKC$S_CURRENCY_NAME" >type="S" >meaning="Currency Name" /> </article> >......... > <VariablesMetadataVO type="VO" name="VariablesMetadataVO"> > <VariablesMetadataVORow> > <ArticleVersionId>101130763</ArticleVersionId> > <VariableCode>OKC$S_CURRENCY_NAME</VariableCode> > <VariableType>S</VariableType> > <DocType>QUOTE</DocType> > <ViewObjectName>HeaderVO</ViewObjectName> > <AttributeName>CurrencyName</AttributeName> > </VariablesMetadataVORow> >................ ><HeaderVO> > <HeaderVORow> > <CurrencyName>Dollars</CurrencyName> > </HeaderVORow> ></HeaderVO> >.......... > > >And the following XSL tempalte to match the *var* tags. > > <xsl:template match="var[@type='S']"> > <xsl:variable name="system" >select="//VariablesMetadataVO/VariablesMetadataVORow[VariableNa >me=current()/@name]"/> Here is your problem. In your predicate, you reference "VariableName", which doesn't exist in your source XML. This returns an empty nodeset for your variable "system". Replace "VariableName" with "VariableCode", and this template match will work, providing the correct output. Just if you want the output in an "article" element, use <xsl:element>. > <xsl:value-of >select="//descendant::[name(.)=$system/ViewObjectName]/descenda >nt::[name(.)=$system/AttributeName]"/> > > </xsl:template> > >the result of applying the template should be some thing like > ><article>som text here Dollars </article> > > > The var tag in the article text points to metadata which in turn >points to the value that has to be substituted in place of the var >tag.We are currently using the folowing Xpath .. but the >parser fails as >the XPath seems to be malformed. What are we missing here?Any >suggesiotns for alternative XPaths?any help is highly appreciated. HTH, RG XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|