d-End--> Newbie question - dynamic filter on attribute values -htdig_noindex-->

This is the mail archive of the xsl-list@mulberrytech.com mailing list .


>
Index Nav: [Date Index] [Subject Inda>] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Thread ]

Ne question - dynamic filter on attribute values


I apologize if this already been discussed, but I am new to XML and XSLT
and have been reading some of the posts and haven't seem to come acroy
situation.  I have data similar to the following:

<book attr="1">
    <title attr="10">This is the title</e>
    <chap attr="20">
        <title attr="25">Chapter title 1</title>
        <para attr="26"> is a paragraph in the first chapter</para>
    </chap>        
    <chap attr="20">
        <title att5">Chapter title 2</title>
        <para attr="26">This is a paragraph in the second chapter</para>
   ;/chap>        
</book>

I would like to initially filter out my document based on the attr values.
I will be recei an array of numbers that correspond to the numbers in
attr.  I only want those elements that match these numbers.  For exam if
I receive 25 and 26, I only want to work with the <title> and <para>
elements.  This array of numbers that Il be receiving will vary from
request to request, meaning I may get a request for only 10 and 25, or just
26.  I would like omehow dynamically combine this logic into the
following stylesheet, but I am not sure how to do it.

<xsl:template matchap/title">
    <FormatScope>
	 <Format>
	     <ESC/>TB
		 </Format>
		 <Content>
		     <:apply-templates/>
		 </Content>
		 <Format>
		     <ESC/>TE
		 </Format>
    </FormatScope>t;/xsl:template>

<xsl:template match="para">
    <FormatScope>
        <Format>
            <ESC/&g
        </Format>
        <Content>
            <xsl:apply-templates/>
        </Content>
        &ormat>
            <ESC/>PE
        </Format>
    </FormatScope>
</xsl:template>
  
The resulting would be:

<FormatScope>
    <Format>
        <ESC/>TB
    </Format>
    <Content>Chapter tit</Content>
    <Format>
        <ESC/>TE
    </Format>
</FormatScope>

<FormatScope>
   HjÂ:;Fmat>
    lt;Content>This is a paragraph in the first chapter</Contet;
    <Format>
        <ESC/>PE
    </Format>
</FormatScope>

<FormatScope>
    <Format>      <ESC/>TB
    </Format>
    <Content>Chapter title 2</Content>
    <Format>
        <Egt;TE
    </Format>
</FormatScope>

<FormatScope>
    <Format>
        <ESC/>PB
    </Forma;
    <Content>This is a paragraph in the second chapter</Content>
    <Format>
        <ESC/>PE
   ;/Format>
</FormatScope>


Using XSLT, is there a way to do what I am trying to accomplish?  Any
suggestions are gry appreciated.

Thanks,
Karen


 XSL-List info and archive:  http://www.errytech.com/xsl/xsl-list

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread In/A>]
Message Nav: [Date Prev]&nbsA HREF="msg00474.html">Date Next] [Thread Prev] [Thread Next]